51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2726|回复: 1
打印 上一主题 下一主题

[求助] 请教loadrunner Sockets协议接收报文为空问题

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2013-8-7 21:03:13 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
刚开始学习loadrunner11,简单编了个脚本,具体内容如下:
vuser_init()
{
lrs_startup(257);
       
        return 0;
}


Action()
{
       
        int rc=0;
        rc = lrs_create_socket("socket0","TCP","LocalHost=0","RemoteHost=20.13.0.216:5555", LrsLastArg);//建立到服务端的连接
if (rc==0)
       lr_output_message("Socket  was successfully created ");
else
       lr_output_message("An error occurred while creating the socket, Error Code: %d", rc);
lrs_send("socket0", "buf0", LrsLastArg);   //往"socket0"发送"buf0"中的数据

lrs_receive("socket0", "buf1", LrsLastArg);//将"socke0"中返回的数据存放到"buf1"中
   
         return 0;
}


vuser_end()
{
lrs_close_socket("socket0");
lrs_cleanup();

        return 0;
}

data.ws内容如下:

;WSRData 2 1

send buf0 6

"123456"  

recv buf1 6


-1


被测试程序可以成功接收到报文内容“123456”,返回的报文不能成功接收,从loadrunner的日志中显示0 bytes were received;被测试程序逻辑很简单,就是接收到的报文原样返回。各位大侠请帮忙看看?

脚本执行后的日志如下:
Virtual User Script started at : 2013-08-07 20:56:59
Starting action vuser_init.
vuser_init.c(11): lrs_startup(257)
Ending action vuser_init.
Running Vuser...
Starting iteration 1.
Starting action Action.
Action.c(7): lrs_create_socket(socket0, TCP, ...)
Action.c(7): callSocket: name: 40351244, socket type: 1
Action.c(7): callBind: socket: socket0 (860), local host: (null), local port: 0
Action.c(7): callConnect: socket: socket0 (860), remote host: 20.13.0.216  remote port: 5555
Action.c(7): callConnect: getting host address from the host name (20.13.0.216).
Action.c(7): callConnect: Wed Aug 07 20:56:59.912: Waiting for writable socket 10 secs, 0 usecs
Action.c(10): Socket  was successfully created
Action.c(18): lrs_send(socket0, buf0)
Action.c(18): callSend: socket: socket0 (860), buffer: buf0
Action.c(18): callSend: Wed Aug 07 20:56:59.942: reading buffer buf0
Action.c(18): callSend: Wed Aug 07 20:56:59.952: calling parameterization routines
Action.c(18): callSend: Wed Aug 07 20:56:59.962: translate buffer to binary
Action.c(18): callSend: Wed Aug 07 20:56:59.962: Translate data for printing
=================================SENT BUFFER=================================
        "123456"
===============================================================================
Action.c(18): callSend: Wed Aug 07 20:57:00.004: About to send 6 bytes to socket0 (860)
Action.c(18): callSend: Wed Aug 07 20:57:00.014: Waiting for writable socket 10 secs, 0 usecs
Action.c(18): callSend: Wed Aug 07 20:57:00.044: Trying to send 6 bytes
Action.c(18): callSend: Wed Aug 07 20:57:00.054: Sent in this iteration 6 bytes (total in all iterations 6 bytes)
Action.c(24): lrs_receive(socket0, buf1)
Action.c(24): fiInitRecv: socket: socket0 (860), buffer: buf1, expected size: 6
Action.c(24): callRecv: Wed Aug 07 20:57:00.094: About to read 6 bytes from socket0 (860)
Action.c(24): fiPerformReceive: Wed Aug 07 20:57:00.104: Waiting for readable socket 10 secs, 0 usecs
Action.c(24): fiPerformReceive: Wed Aug 07 20:57:10.120: Select timed out
Action.c(24): Mismatch in buffer's length (expected 6 bytes, 0 bytes actually received, difference in 6 bytes)
Action.c(24): fiCheckRecvMismatch: Wed Aug 07 20:57:10.130: reading buffer buf1
Action.c(24): fiCheckRecvMismatch: Wed Aug 07 20:57:10.140: calling parameterization routines
================================EXPECTED BUFFER================================
===============================================================================
Action.c(24): getAsciiReceivedBuffer: Wed Aug 07 20:57:10.150: Translate data for printing
Action.c(24): getAsciiReceivedBuffer: Wed Aug 07 20:57:10.150: Binary to ascii
================================RECEIVED BUFFER================================
===============================================================================
Action.c(24): callRecv:0 bytes were received
Ending action Action.
Ending iteration 1.
Ending Vuser...
Starting action vuser_end.
vuser_end.c(5): lrs_close_socket(socket0)
vuser_end.c(5): callCloseSocket: socket: socket0 (860)
vuser_end.c(6): lrs_cleanup()
Ending action vuser_end.
Vuser Terminated.
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
发表于 2013-8-8 16:40:09 | 只看该作者
确定被测程序进行了回复吗?
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-11-22 21:09 , Processed in 0.071791 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表