51Testing软件测试论坛
标题:
winsocket要效验接收的报文该怎么效验呢?
[打印本页]
作者:
cherry-rome
时间:
2016-3-25 17:39
标题:
winsocket要效验接收的报文该怎么效验呢?
发送报文和接收报文均已写入data文件,想核验发送报文后接收到的报文是否与写入data文件里的receive【5】和receive【6】一致?新人一个,不知道用什么函数来写?
lrs_get_last_received_buffer("socket0",&Buf3,&Len);和 lr_eval_string()这两个函数要用到吗?
#include "lrs.h"
Action()
{
int sc;
lr_start_transaction("sign");
lr_think_time(2);
sc=lrs_create_socket("socket0","TCP","RemoteHost=192.158.15.141:36549",LrsLastArg);
lrs_send("socket0","buf0",LrsLastArg);
lrs_receive("socket0", "buf1", LrsLastArg);
lr_end_transaction("sign", LR_AUTO);
return 0;
}
data.ws
g;WSRData 2 1
send buf0 91
"\x00\x5b\"
recv buf1 117
"\x00\x75\x60\x00\x00\x04\x01\x61\x32\x00\x32\x15\x01\x08\x10\x00\x38\x00\x01\x0a\xc0\x00\x14\x00\x14\x50\x14\x04\x50\x03\x25\x00\x31\x34\x30\x34\x35\x30\x33\x32\x38\x39\x34\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x33"
-1
作者:
cherry-rome
时间:
2016-3-29 11:24
自己研究出来了,用到 lrs_save_param函数取偏移量,
lrs_receive("socket0", "buf1", LrsLastArg);
lrs_save_param("socket0","buf1","back2",88,4);
lr_output_message("code is=%s",lr_eval_string("<back2>"));
if(strcmp(lr_eval_string("<back2>"),"3030")==0)
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2