LoadRunner Winsocket协议知识总结V1[1].1(修正版)
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
3.环境函数........................................................................................................................... 20 lrs_cleanup 终止 Windows 套接字 DLL 的使用 .......................................................20 lrs_startup 初始化 Windows 套接字 DLL ..................................................................20
1.基本函数............................................................................................................................. 3 lrs_accept_connection 接受侦听套接字连接 ................................................................ 3 lrs_close_socket 关闭打开的套接字 .............................................................................. 3 lrs_create_socket 初始化套接字..................................................................................... 4 lrs_disable_socket 禁用套接字操作 ............................................................................... 4 lrs_exclude_socket 重播期间排除套接字 ...................................................................... 5 lrs_get_socket_attrib 获取套接字属性...........................................................................6 lrs_get_socket_handler 获取指定套接字的套接字句柄 ...............................................6 lrs_length_receive 接收来自指定长度的缓冲区的数据 ...............................................7 lrs_length_send 向流套接字发送指定长度的缓冲区数据 ...........................................7 lrs_receive 接收来自套接字的数据 ............................................................................... 7 lrs_receive_ex 接收指定长度的数据报或流套接字......................................................8 lrs_send 将数据发送到数据报上或流套接字中 ...........................................................9 lrs_set_receive_option 设置套接字接收选项 ..............................................................10 lrs_set_socket_handler 为指定的套接字设置处理句柄 .............................................11 lrs_set_socket_options 设置套接字选项......................................................................12
2.缓冲区函数....................................................................................................................... 13 lrs_free_buffer 释放分配给缓冲区的内存...................................................................13 lrs_get_buffer_by_name 从数据文件中获取缓冲区及其大小 ...................................13 lrs_get_last_received_buffer 获取套接字上最后接收到的缓冲区数据及其大小 .....14 lrs_get_last_received_buffer_size 获取套接字上接收到的最后一个缓冲区的大小 .16 lrs_get_received_buffer 获取指定长度的最后接收到的缓冲区数据.........................16 lrs_get_static_buffer 获取静态缓冲区或其一部分......................................................17 lrs_get_user_buffer 获取套接字的用户数据的内容 ...................................................18 lrs_get_user_buffer_size 获取套接字的用户缓冲区的长度 .......................................19 lrs_set_send_buffer 指定要在套接字上发送的缓冲区...............................................19
目录
序 ......................................................................................................................................................1 修正版说明.......................................................................................................................................2 一、函数...........................................................................................................................................3
4.关联语句函数................................................................................................................... 21 lrs_save_param 将静态或接收到的缓冲区(或缓冲区部分)保存到参数中..........21
2
LoadRunner Winsocket 协议知识总结
tian.yuanwen@dcfs.digitalchina.com
lrs_save_param_ex 将用户、静态或接收到的缓冲区(或缓冲区部分)保存到参数 中.....................................................................................................................................22 lrs_save_searched_string 在静态或接收到的缓冲区中搜索出现的字符串,将出现字 符串的缓冲区部分保存到参数中 ................................................................................. 23 5.转换函数........................................................................................................................... 25 lrs_ascii_to_ebcdic 将缓冲区数据从 ASCII 格式转换成 EBCDIC 格式 ....................25 lrs_decimal_to_hex_string 将十进制整数转换为十六进制字符串 ............................26 lrs_ebcdic_to_ascii 将缓冲区数据从 EBCDIC 格式转换成 ASCII 格式 ......................26 lrs_hex_string_to_int 将十六进制字符串转换为整数.................................................27 6.超时函数........................................................................................................................... 28 lrs_set_accept_timeout 为接受套接字设置超时.........................................................28 lrs_set_connect_timeout 为连接到套接字设置超时 ..................................................28 lrs_set_recv_timeout 为接收套接字上的初始预期数据设置超时.............................29 lrs_set_recv_timeout2 为建立连接后接收套接字上的预期数据设置超时...............29 lrs_set_send_timeout 为发送套接字数据设置超时....................................................30 7.Receive and Send Flags ..................................................................................................... 31 二、LRS 错误码 ..............................................................................................................................31 三、常见问题.................................................................................................................................39 1.一个完整的 VuGen 脚本(Winsocket TCP)..................................................................39 2.VuGen 脚本格式说明.......................................................................................................46 3. 脚本的参数化.................................................................................................................... 47 3.data.ws 中的 send 和 recv................................................................................................ 47 4.Mismatch 的问题.............................................................................................................. 47 5.lrs_receive 等待时间太长的问题 ....................................................................................48 6.一个对上传数据处理的例子 ........................................................................................... 48 7.从文件中读取数据到用户缓冲区 ................................................................................... 49 8.10053 错误说明................................................................................................................51 9.编码方式........................................................................................................................... 51 四、本文档遗留问题..................................................................................................................... 51 五、知识链接.................................................................................................................................52 1.带外数据(out‐of‐band,OOB).......................................................................................... 52 2.阻塞和非阻塞(blocking 和 non‐blocking) ..................................................................52 3.TCP_NODELAY 和 TCP_CORK ............................................................................................53 4.什么是句柄....................................................................................................................... 54 六、结束语.....................................................................................................................................55
LoadRunner Winsocket 协议知识总结
tian.yuanwen@dcfs.digitalchina.com
LoadHale Waihona Puke Baiduunner Winsocket 协议知识总结
测试中心 田渊文
2007 年 11 月 9 日
1
LoadRunner Winsocket 协议知识总结
tian.yuanwen@dcfs.digitalchina.com
1.基本函数............................................................................................................................. 3 lrs_accept_connection 接受侦听套接字连接 ................................................................ 3 lrs_close_socket 关闭打开的套接字 .............................................................................. 3 lrs_create_socket 初始化套接字..................................................................................... 4 lrs_disable_socket 禁用套接字操作 ............................................................................... 4 lrs_exclude_socket 重播期间排除套接字 ...................................................................... 5 lrs_get_socket_attrib 获取套接字属性...........................................................................6 lrs_get_socket_handler 获取指定套接字的套接字句柄 ...............................................6 lrs_length_receive 接收来自指定长度的缓冲区的数据 ...............................................7 lrs_length_send 向流套接字发送指定长度的缓冲区数据 ...........................................7 lrs_receive 接收来自套接字的数据 ............................................................................... 7 lrs_receive_ex 接收指定长度的数据报或流套接字......................................................8 lrs_send 将数据发送到数据报上或流套接字中 ...........................................................9 lrs_set_receive_option 设置套接字接收选项 ..............................................................10 lrs_set_socket_handler 为指定的套接字设置处理句柄 .............................................11 lrs_set_socket_options 设置套接字选项......................................................................12
2.缓冲区函数....................................................................................................................... 13 lrs_free_buffer 释放分配给缓冲区的内存...................................................................13 lrs_get_buffer_by_name 从数据文件中获取缓冲区及其大小 ...................................13 lrs_get_last_received_buffer 获取套接字上最后接收到的缓冲区数据及其大小 .....14 lrs_get_last_received_buffer_size 获取套接字上接收到的最后一个缓冲区的大小 .16 lrs_get_received_buffer 获取指定长度的最后接收到的缓冲区数据.........................16 lrs_get_static_buffer 获取静态缓冲区或其一部分......................................................17 lrs_get_user_buffer 获取套接字的用户数据的内容 ...................................................18 lrs_get_user_buffer_size 获取套接字的用户缓冲区的长度 .......................................19 lrs_set_send_buffer 指定要在套接字上发送的缓冲区...............................................19
目录
序 ......................................................................................................................................................1 修正版说明.......................................................................................................................................2 一、函数...........................................................................................................................................3
4.关联语句函数................................................................................................................... 21 lrs_save_param 将静态或接收到的缓冲区(或缓冲区部分)保存到参数中..........21
2
LoadRunner Winsocket 协议知识总结
tian.yuanwen@dcfs.digitalchina.com
lrs_save_param_ex 将用户、静态或接收到的缓冲区(或缓冲区部分)保存到参数 中.....................................................................................................................................22 lrs_save_searched_string 在静态或接收到的缓冲区中搜索出现的字符串,将出现字 符串的缓冲区部分保存到参数中 ................................................................................. 23 5.转换函数........................................................................................................................... 25 lrs_ascii_to_ebcdic 将缓冲区数据从 ASCII 格式转换成 EBCDIC 格式 ....................25 lrs_decimal_to_hex_string 将十进制整数转换为十六进制字符串 ............................26 lrs_ebcdic_to_ascii 将缓冲区数据从 EBCDIC 格式转换成 ASCII 格式 ......................26 lrs_hex_string_to_int 将十六进制字符串转换为整数.................................................27 6.超时函数........................................................................................................................... 28 lrs_set_accept_timeout 为接受套接字设置超时.........................................................28 lrs_set_connect_timeout 为连接到套接字设置超时 ..................................................28 lrs_set_recv_timeout 为接收套接字上的初始预期数据设置超时.............................29 lrs_set_recv_timeout2 为建立连接后接收套接字上的预期数据设置超时...............29 lrs_set_send_timeout 为发送套接字数据设置超时....................................................30 7.Receive and Send Flags ..................................................................................................... 31 二、LRS 错误码 ..............................................................................................................................31 三、常见问题.................................................................................................................................39 1.一个完整的 VuGen 脚本(Winsocket TCP)..................................................................39 2.VuGen 脚本格式说明.......................................................................................................46 3. 脚本的参数化.................................................................................................................... 47 3.data.ws 中的 send 和 recv................................................................................................ 47 4.Mismatch 的问题.............................................................................................................. 47 5.lrs_receive 等待时间太长的问题 ....................................................................................48 6.一个对上传数据处理的例子 ........................................................................................... 48 7.从文件中读取数据到用户缓冲区 ................................................................................... 49 8.10053 错误说明................................................................................................................51 9.编码方式........................................................................................................................... 51 四、本文档遗留问题..................................................................................................................... 51 五、知识链接.................................................................................................................................52 1.带外数据(out‐of‐band,OOB).......................................................................................... 52 2.阻塞和非阻塞(blocking 和 non‐blocking) ..................................................................52 3.TCP_NODELAY 和 TCP_CORK ............................................................................................53 4.什么是句柄....................................................................................................................... 54 六、结束语.....................................................................................................................................55
LoadRunner Winsocket 协议知识总结
tian.yuanwen@dcfs.digitalchina.com
LoadHale Waihona Puke Baiduunner Winsocket 协议知识总结
测试中心 田渊文
2007 年 11 月 9 日
1
LoadRunner Winsocket 协议知识总结
tian.yuanwen@dcfs.digitalchina.com