|
测试程序:C/S端,主要功能门禁刷卡,使用协议.net tcp和http,后台数据库是用sql server
问题:用http协议录制,打卡的数据不能录到,代码是空的;用ms sql server录制也一样,后来直接用socket协议录制,用该协议可以录制,在data.ws中可以找到打卡的数据,但是回放的时候出现mismatch提示,还有打卡记录在数据库找不到,也就是插入数据不成功
录制的代码:
#include "lrs.h"
Action()
{
lrs_create_socket("socket0", "TCP", "RemoteHost=172.168.1.39:200", LrsLastArg);
lrs_send("socket0", "buf0", LrsLastArg);
lrs_receive("socket0", "buf1", LrsLastArg);
lrs_send("socket0", "buf2", LrsLastArg);
lrs_receive("socket0", "buf3", LrsLastArg);
lrs_send("socket0", "buf4", LrsLastArg);
lrs_receive("socket0", "buf5", LrsLastArg);
lrs_send("socket0", "buf6", LrsLastArg);
lrs_set_receive_option(EndMarker,EndMarker_None);
lrs_receive("socket0", "buf7", LrsLastArg);
lrs_create_socket("socket1", "TCP", "RemoteHost=172.168.1.39:8780", LrsLastArg);
lrs_send("socket1", "buf8", LrsLastArg);
lrs_receive("socket1", "buf9", LrsLastArg);
lrs_send("socket1", "buf10", LrsLastArg);
lrs_receive("socket1", "buf11", LrsLastArg);
lrs_send("socket1", "buf12", LrsLastArg);
lr_think_time(6);
lrs_send("socket1", "buf13", LrsLastArg);
lrs_create_socket("socket2", "TCP", "RemoteHost=172.168.1.39:8780", LrsLastArg);
lrs_send("socket2", "buf14", LrsLastArg);
lrs_receive("socket2", "buf15", LrsLastArg);
lrs_send("socket2", "buf16", LrsLastArg);
lrs_receive("socket2", "buf17", LrsLastArg);
lrs_send("socket2", "buf18", LrsLastArg);
lrs_receive("socket2", "buf19", "Flags=MSG_PEEK",LrsLastArg);
lrs_send("socket2", "buf20", LrsLastArg);
lrs_send("socket0", "buf21", LrsLastArg);
lrs_receive("socket0", "buf22", LrsLastArg);
lrs_send("socket0", "buf23", LrsLastArg);
lrs_receive("socket0", "buf24", LrsLastArg);
lrs_send("socket1", "buf25", LrsLastArg);
lrs_create_socket("socket3", "TCP", "RemoteHost=172.168.1.39:8780", LrsLastArg);
lrs_send("socket3", "buf26", LrsLastArg);
lrs_receive("socket3", "buf27", LrsLastArg);
lrs_send("socket3", "buf28", LrsLastArg);
lrs_receive("socket3", "buf29", LrsLastArg);
lrs_send("socket3", "buf30", LrsLastArg);
lrs_receive("socket3", "buf31", LrsLastArg);
lrs_send("socket3", "buf32", LrsLastArg);
lrs_send("socket1", "buf33", LrsLastArg);
lrs_create_socket("socket4", "TCP", "RemoteHost=172.168.1.39:201", LrsLastArg);
lrs_send("socket4", "buf34", LrsLastArg);
lrs_receive("socket4", "buf35", LrsLastArg);
lrs_send("socket4", "buf36", LrsLastArg);
lrs_receive("socket4", "buf37", LrsLastArg);
lrs_send("socket4", "buf38", LrsLastArg);
lrs_receive("socket4", "buf39", LrsLastArg);
lrs_send("socket4", "buf40", LrsLastArg);
lrs_receive("socket4", "buf41", LrsLastArg);
lr_start_transaction("test");
lr_think_time(13);
lrs_send("socket1", "buf42", LrsLastArg);
lr_think_time(6);
lrs_send("socket1", "buf43", LrsLastArg);
lrs_create_socket("socket5", "TCP", "RemoteHost=172.168.1.39:8780", LrsLastArg);
lrs_send("socket5", "buf44", LrsLastArg);
lrs_receive("socket5", "buf45", LrsLastArg);
lrs_send("socket5", "buf46", LrsLastArg);
lrs_receive("socket5", "buf47", LrsLastArg);
lrs_send("socket5", "buf48", LrsLastArg);
lrs_receive("socket5", "buf49", LrsLastArg);
lrs_send("socket5", "buf50", LrsLastArg);
lrs_send("socket1", "buf51", LrsLastArg);
lr_end_transaction("test", LR_AUTO);
lr_think_time(10);
lrs_send("socket0", "buf52", LrsLastArg);
lrs_receive("socket0", "buf53", LrsLastArg);
lrs_send("socket0", "buf54", LrsLastArg);
lrs_receive("socket0", "buf55", LrsLastArg);
lrs_send("socket0", "buf56", LrsLastArg);
lrs_receive("socket0", "buf57", LrsLastArg);
lrs_send("socket0", "buf58", LrsLastArg);
lrs_receive("socket0", "buf59", LrsLastArg);
lrs_close_socket("socket5");
lrs_close_socket("socket1");
lrs_close_socket("socket2");
lrs_close_socket("socket3");
lrs_close_socket("socket4");
lrs_close_socket("socket0");
return 0;
}
刚接触LR,对socket不是很了解,出现mismatch问题百度后方法不适用,发个求助帖,求支招
|
|