51Testing软件测试论坛

标题: 测试socket,提示Connection reset by peer. Error code : 10054. [打印本页]

作者: YapsiLee    时间: 2015-7-3 09:34
标题: 测试socket,提示Connection reset by peer. Error code : 10054.
使用LR测试一个支付系统,初步采用socket测压力。send数据正常,但是到接收收据的时候,一直提示Connection reset by peer. Error code : 10054.
查看了网上好多的方法,似乎都没有效果,来此求助了。
代码如下:
#include "lrs.h"

Action()
{

        int i;
        char *ActualBuffer;        //定义字符指针
        int NumberOfBytes;//定义int型变量保存长度

        lrs_create_socket("Pays", "UDP", "LocalHost=2425", LrsLastArg);

        for(i=0;i<1;i++)
        {
                lr_start_transaction("Send");
               
                lrs_send("Pays", "buf1", "TargetSocket=10.9.32.18:8443", LrsLastArg);
                lrs_get_buffer_by_name("buf1", &ActualBuffer, &NumberOfBytes);
               
                lr_output_message("The buffer1's size is: %d\n", NumberOfBytes);
       
                lr_think_time(5);
               
                lrs_receive("Pays", "buf2", LrsLastArg);       
                lrs_get_buffer_by_name("buf2", &ActualBuffer, &NumberOfBytes);
               
                lr_end_transaction("Send", LR_AUTO);
        }

        lrs_free_buffer(ActualBuffer);
        lrs_close_socket("Pays");

        return 0;
}

日志为:
Starting action Action.
Action.c(18): lrs_create_socket(Pays, UDP, ...)
Action.c(18): callSocket: name: 18651628, socket type: 2
Action.c(18): callBind: socket: Pays (1408), local host: (null), local port: 2425
Action.c(20): hello
Action.c(24): Notify: Transaction "Send" started.
Action.c(26): lrs_send(Pays, buf1)
Action.c(26): callSend: socket: Pays (1408), buffer: buf1
Action.c(26): callSend: Fri Jul 03 09:22:50.042: reading buffer buf1
Action.c(26): callSend: Fri Jul 03 09:22:50.057: calling parameterization routines
Action.c(26): callSend: Fri Jul 03 09:22:50.057: translate buffer to binary
Action.c(26): callSend: Fri Jul 03 09:22:50.057: Translate data for printing
=================================SENT BUFFER=================================
        "test"
===============================================================================
Action.c(26): callSend: getting host address from the host name (10.9.32.18).
Action.c(26): callSend: Fri Jul 03 09:22:50.386: About to send 4 bytes to Pays (1408)
Action.c(26): callSend: Fri Jul 03 09:22:50.386: Waiting for writable socket 10 secs, 0 usecs
Action.c(26): callSend: Fri Jul 03 09:22:50.401: Sent in this iteration 4 bytes (total in all iterations 4 bytes)
Action.c(27): lrs_get_buffer_by_name (buf1, buf_p, size_p)
Action.c(27): callGetStaticBuffer: buffer: buf1, offset: 0, length: -1
Action.c(27): callGetStaticBuffer: Fri Jul 03 09:22:50.417: reading buffer buf1
Action.c(27): callGetStaticBuffer: Fri Jul 03 09:22:50.417: calling parameterization routines
Action.c(27): callGetStaticBuffer: translate buffer to binary
Action.c(27): callGetStaticBuffer: translate buffer to ascii
Action.c(29): The buffer1's size is: 4
Action.c(31): lr_think_time: 5.00 seconds.
Action.c(33): lrs_receive(Pays, buf2)
Action.c(33): fiInitRecv: socket: Pays (1408), buffer: buf2, expected size: 11
Action.c(33): callRecv: Fri Jul 03 09:22:55.479: About to read 11 bytes from Pays (1408)
Action.c(33): fiPerformReceive: Fri Jul 03 09:22:55.495: Waiting for readable socket 10 secs, 0 usecs
Action.c(33): recv_buf: Fri Jul 03 09:22:55.495: Trying to read 65507 bytes
Action.c(33): Error : Pays - Connection reset by peer. Error code : 10054.
Action.c(33): Notify: Transaction "Send" ended with "Fail" status (Duration: 5.4686 Think Time: 4.9995).
Abort was called from an action.
Ending Vuser...
Starting action vuser_end.
vuser_end.c(6): lrs_cleanup()
vuser_end.c(6): callCloseSocket: socket: Pays (1408)
Ending action vuser_end.
Vuser Terminated.

data.ws数据为:
;WSRData 2 1

send buf1 4
        "test"

recv buf2 11
        "hello, test"

-1

在线等,谢谢各位了。
作者: seagull1985    时间: 2015-7-3 13:57
有没有修改过data.ws中的数据,如果修改过,改回原始状态试试
作者: jingzizx    时间: 2015-7-3 15:57
lrs_receive接收长度不等于预期长度,会重新接收socket的数据,直到超时为止。
Action.c(33): fiInitRecv: socket: Pays (1408), buffer: buf2, expected size: 11
要接收11个字符,你试试

作者: YapsiLee    时间: 2015-7-9 19:14
seagull1985 发表于 2015-7-3 13:57
有没有修改过data.ws中的数据,如果修改过,改回原始状态试试

没有原始值,这个值是我跟开发要来的,他们告诉我的内容。
作者: YapsiLee    时间: 2015-7-9 19:15
jingzizx 发表于 2015-7-3 15:57
lrs_receive接收长度不等于预期长度,会重新接收socket的数据,直到超时为止。
Action.c(33): fiInitRecv ...

expected size:11,这个长度不是我在ws.data中设置的长度吗?




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2