lr的winsocket协议怎么从实际接受报文中读数据而不是在buffer中读取
在写好winsocket 协议的脚本后,需要验证接收报文的合法性,使用了函数lrs_receive("socket0", "buf1", LrsLastArg);
lrs_save_param("socket0","buf1","back2",266,4);
lr_output_message("code is=%s",lr_eval_string("<back2>"));
if(strcmp(lr_eval_string("<back2>"),"3030")==0)
{
//lr_output_message("pass");
lr_end_transaction("sign", LR_PASS);
}
else
{
//lr_output_message("fail");
lr_end_transaction("sign", LR_FAIL);
后来发现这个判定的值是rec buffer里的值,并不是实时接收的。有什么办法改善吗? 自己弄出来,感谢天感谢地址:
在此记下:
#include "lrs.h"
Action()
{
lrs_create_socket("socket0","TCP","RemoteHost=XXXXXXXX:XXXX",LrsLastArg);
lr_start_transaction("消费");
lrs_send("socket0","buf0",LrsLastArg);
lrs_receive("socket0", "buf1", LrsLastArg);
lrs_save_param_ex("socket0","received","buf1",44,2,"ebcdic","Response1");
lr_output_message ("消费Response: %s", lr_eval_string("<Response1>"));
//position=(char*)strstr(lr_eval_string("<Response1>"),lr_eval_string("0170100400"));
if(strcmp(lr_eval_string("<Response1>"),"00")==0)
{lr_end_transaction("消费", LR_PASS);}
else
{lr_end_transaction("消费", LR_FAIL);}
return 0;
}
;WSRData 2 1
sendbuf0 93
"\x00\x5b\x60\x04\x01\x00\x00\x61\x32\x00\x32\x15\x01\x08\x00\x00\x20\x00\x00\x00\xc0\x00\x16\x00\x14\x29\x30\x30\x30\x30\x30\x30\x30\x33\x30\x30\x30\x30\x30\x30\x30\x30\30\x30\x30\x30\x30\x33\x00\x11\x00\x00\x00\x08\x00\x30\x00\x29\x53\x65\x71\x75\x65\x6e\x63\x65\x20\x4e\x6f\x31\x36\x33\x30\x39\x34\x53\x58\x58\x2d\x32x32\x31\x31\x32\x35\x37\x00\x03\x30\x31\x20"
recvbuf1 11
-1
页:
[1]