51zsedc 发表于 2016-5-23 11:51:48

【加急】loadrunner 11 写发送udp报文,返回接受数据为空

如题

51zsedc 发表于 2016-5-23 11:52:35

本帖最后由 51zsedc 于 2016-5-23 12:26 编辑

#include "lrs.h"


Action()
{
      int rc;
      //--------------创建连接-----------------
      rc= lrs_create_socket("socket0", "UDP", "LocalHost=0", "RemoteHost=183.207.215.46:3478", 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_create_socket("socket0", "UDP", "LocalHost=0", "RemoteHost=183.207.215.46:3478", LrsLastArg);

      lrs_send("socket0", "buf0", LrsLastArg);

      lrs_receive("socket0", "buf1", LrsLastArg);

      lrs_close_socket("socket0");
    return 0;
}
;WSRData 2 1
sendbuf0 86
      "\x00\x01\x00\x3c\x55\x63\xb2\xfa\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\x01\x00\x14\x64\x73\x6c\x66\x6f\x72\x75\x6d\x2e\x6f\x72\x67x2f\x54\x52\x2d\x31\x31\x31\x20\x00\x06\x00\x20\x30\x30\x31\x30\x30\x31\x39\x39\x30\x30\x36\x30\x31\x33\x38\x30\x30\x30\x30\x36\x30\x30\x30\x37\x36\x33\x32\x64\x65\x33\x61\x66"
recvbuf1 199

-1



51zsedc 发表于 2016-5-23 11:53:35

感谢赐教

51zsedc 发表于 2016-5-23 11:54:16

本帖最后由 51zsedc 于 2016-5-23 12:21 编辑

51zsedc 发表于 2016-5-23 11:54:29

虚拟用户脚本已从 : 2016-05-23 11:36:47 启动
正在开始操作 vuser_init。
vuser_init.c(6): lrs_startup(257)
正在结束操作 vuser_init。
正在运行 Vuser...
正在开始迭代 1。
正在开始操作 Action。
Action.c(8): lrs_create_socket(socket0, UDP, ...)
Action.c(8): callSocket: name: 44259340, socket type: 2
Action.c(8): callBind: socket: socket0 (836), local host: (null), local port: 0
Action.c(8): callConnect: socket: socket0 (836), remote host: 183.207.215.46remote port: 3478
Action.c(8): callConnect: 从主机名(183.207.215.46)获取主机地址。
Action.c(11): Socket was successfully created
Action.c(18): lrs_send(socket0, buf0)
Action.c(18): callSend: socket: socket0 (836), buffer: buf0
Action.c(18): callSend: Mon May 23 11:36:47.173: reading buffer buf0
Action.c(18): callSend: Mon May 23 11:36:47.176: calling parameterization routines
Action.c(18): callSend: Mon May 23 11:36:47.180: translate buffer to binary
Action.c(18): callSend: Mon May 23 11:36:47.183: Translate data for printing
=================================SENT BUFFER=================================
        "\x00\x01\x00"
        "<Uc产"
        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\x01\x00\x14"
        "dslforum.orgx2fTR-111 "
        "\x00\x06\x00"
        " 001001990060138000060007632de3af"
===============================================================================
Action.c(18): callSend: Mon May 23 11:36:47.208: About to send 82 bytes to socket0 (836)
Action.c(18): callSend: Mon May 23 11:36:47.214: Waiting for writable socket 10 secs, 0 usecs
Action.c(18): callSend: Mon May 23 11:36:47.219: Trying to send 82 bytes
Action.c(18): callSend: Mon May 23 11:36:47.225: Sent in this iteration 82 bytes (total in all iterations 82 bytes)
Action.c(20): lrs_receive(socket0, buf1)
Action.c(20): fiInitRecv: socket: socket0 (836), buffer: buf1, expected size: 199
Action.c(20): callRecv: Mon May 23 11:36:47.248: About to read 199 bytes from socket0 (836)
Action.c(20): fiPerformReceive: Mon May 23 11:36:47.254: Waiting for readable socket 10 secs, 0 usecs
Action.c(20): fiPerformReceive: Mon May 23 11:36:57.261: Select timed out
Action.c(20): Mismatch in buffer's length (expected 199 bytes, 0 bytes actually received, difference in 199 bytes)
Action.c(20): fiCheckRecvMismatch: Mon May 23 11:36:57.296: reading buffer buf1
Action.c(20): fiCheckRecvMismatch: Mon May 23 11:36:57.303: calling parameterization routines
================================EXPECTED BUFFER================================
===============================================================================
Action.c(20): getAsciiReceivedBuffer: Mon May 23 11:36:57.321: Translate data for printing
Action.c(20): getAsciiReceivedBuffer: Mon May 23 11:36:57.324: Binary to ascii
================================RECEIVED BUFFER================================
===============================================================================
Action.c(20): callRecv:data was received from sunniwell-PC
Action.c(20): callRecv:0 bytes were received
Action.c(22): lrs_close_socket(socket0)
Action.c(22): callCloseSocket: socket: socket0 (836)
正在结束操作 Action。
正在结束迭代 1。
正在结束 Vuser...
正在开始操作 vuser_end。
vuser_end.c(6): lrs_cleanup()
正在结束操作 vuser_end。
Vuser 已终止。

51zsedc 发表于 2016-5-23 11:54:45

本帖最后由 51zsedc 于 2016-5-23 12:20 编辑

51zsedc 发表于 2016-5-23 11:54:55

本帖最后由 51zsedc 于 2016-5-23 12:27 编辑

51zsedc 发表于 2016-5-23 12:03:00

(⊙﹏⊙)b重复了好多。

51zsedc 发表于 2016-5-23 13:39:51

新手小白,求大神帮助。

51zsedc 发表于 2016-5-23 14:54:41

51zsedc 发表于 2016-5-23 15:31:20

求解答啊,各位大神。

jingzizx 发表于 2016-5-23 15:37:31

看看服务端日志记录如何,有没有错误显示

51zsedc 发表于 2016-5-23 15:56:53

jingzizx 发表于 2016-5-23 15:37
看看服务端日志记录如何,有没有错误显示

这个我感觉是我的报文没有发到服务器上。所以服务器给我返回的是callRecv:0 bytes were received

51zsedc 发表于 2016-5-23 19:22:20

:'(

51zsedc 发表于 2016-5-24 14:58:58

好吧
页: [1]
查看完整版本: 【加急】loadrunner 11 写发送udp报文,返回接受数据为空