z309466902 发表于 2012-11-13 09:29:35

再请教一个问题,我现在想用LR的sockets测试UDP协议

再请教一个问题,我现在想用LR的sockets测试UDP协议
流程是:
1、客户端发起登录请求UDP格式
2、服务器返回随机数

问题:
1、服务器返回的随机数LR可以接收到,但在抓包工具中查看,服务器多次返回了随机数,且lr获取随机数事务结束很慢,但实际情况是获取随机数很快,请大家帮帮忙,看看问题出在那边

抓包
U.........;.....Y<75558010312>{"sno":1,"timeStamp":"2012-11-13 01:06:55.832","userAccount":"75558010312"}
U................U....8....<.....c{"nonce":"3844628282","resultCode":401,"sno":1,"timeStamp":"2012-11-13 09:15:50","userAccount":""}
U....8....<.....c{"nonce":"3844628282","resultCode":401,"sno":1,"timeStamp":"2012-11-13 09:15:50","userAccount":""}
U....8....<.....c{"nonce":"3844628282","resultCode":401,"sno":1,"timeStamp":"2012-11-13 09:15:50","userAccount":""}

LR脚本
Action()
{
               lrs_create_socket("socket0", "UDP", "LocalHost=18998",LrsLastArg);

       lrs_send("socket0", "buf0", "TargetSocket=10.137.86.5:8089", LrsLastArg);
                lrs_set_recv_timeout2(5,0);

        lr_start_transaction("GetRamom");

        lrs_receive("socket0", "buf1", LrsLastArg);
        lrs_save_searched_string("socket0",NULL,"RAMOM1","LB=nonce\":","RB=\"",3,1,-1);
        lrs_save_searched_string("socket0",NULL,"resultCode","LB=resultCode\"","RB=,",3,1,-1);

        if (strcmp(lr_eval_string("<resultCode>"),"401")==0) {
                lr_end_transaction("GetRamom", LR_PASS);
        }
       
        lr_output_message("resultCode is : %s",lr_eval_string("<resultCode>"));
        lr_output_message("RAMOM is : %s",lr_eval_string("<RAMOM1>"));
    return 0;
}


LR 获取随机数运行结果:
Action.c(23): Notify: Transaction "GetRamom" ended with "Pass" status (Duration: 11.0700 Wasted Time: 5.0000).
页: [1]
查看完整版本: 再请教一个问题,我现在想用LR的sockets测试UDP协议