Loadrunner winsocket 接收数据失败,请大神帮忙啊?
action.c的处理char *actual_buffer;
int num_bytes;
...........
lrs_save_param_ex("socket0","user",(char *)&pack,0,pack.length,NULL,"sendData");
lrs_startup(257);
rc=lrs_create_socket("socket0","UDP","LocalHost=<ip>:4096","RemoteHost=192.168.16.210:8805", LrsLastArg);
if (rc == 0) {
lr_output_message("socke 连接成功!");
}else{
lr_output_message("socke 连接失败!");
}
rc = lrs_send ("socket0","buf0" ,LrsLastArg );
if (rc == 0) {
lr_output_message("send buf success !");
}else{
lr_output_message("send buf failed !");
}
rc = lrs_receive ("socket0","buf1" ,LrsLastArg );
if (rc == 0) {
lr_output_message("recv buf success !");
}else{
lr_output_message("recv buf failed !");
}
lrs_get_last_received_buffer("socket0",&actual_buffer,&num_bytes);
lrs_save_param_ex("socket0", "user", actual_buffer, 0, num_bytes, NULL, "recv_data");
lr_output_message("The new parameter = %s \n", lr_eval_string("<recv_data>"));
lrs_close_socket("socket0");
data.ws
;WSRData 2 1
send buf0 *
"<send_data>"
recv buf1 *
-1
打印信息
Action.c(411): lrs_receive(socket0, buf1)
Action.c(411): fiInitRecv: socket: socket0 (644), buffer: buf1, expected size: 0
Action.c(411): callRecv: Sat Nov 23 16:27:56.625: About to read 0 bytes from socket0 (644)
Action.c(411): getAsciiReceivedBuffer: Sat Nov 23 16:27:56.625: Translate data for printing
Action.c(411): getAsciiReceivedBuffer: Sat Nov 23 16:27:56.625: Binary to ascii
================================RECEIVED BUFFER================================
===============================================================================
Action.c(411): callRecv:data was received from tzh
Action.c(411): callRecv:0 bytes were received
Action.c(414): recv buf success !
不知道为何接收数据一直为0,数据是动态变化,长度不固定,不知道data.ws 里那样写是不是有问题? 应该出在关联上,如果不是的话应该是winsocket协议版本的问题~
页:
[1]