|
本帖最后由 237667173 于 2012-4-12 22:52 编辑
录制环境 lr11 winsock 协议. 录制.net程序, 脚本调试后回放正常(socket中send和receive包都能捕获到)
代码
int GetReceiveCharPoint(char* cSocket)
{
int iGReceive,iMaxSize = 2084000,iRCount = 0,iReturn = 0;
char cTmp[50];
lr_free_parameter("GetReceive");
itoa(iMaxSize,cTmp,10);
sprintf(cTmp,"NumberOfBytesToRecv=%d",iMaxSize);
do
{
iReturn = lrs_receive_ex(cSocket,"bufYY",cTmp,LrsLastArg);
iGReceive = lrs_get_last_received_buffer_size(cSocket);
lrs_save_param(cSocket,NULL,"GetReceive",0,iGReceive); iRCount++;
lrs_free_buffer("bufYY");
}while (iGReceive == iMaxSize) ;
lr_output_message(lr_eval_string("<GetReceive>"));
return iReturn;
}
int LrsSendAndReceive(char *buf_desc, int isReturn, int iTimeOut)
{
int iGetReceive,iJudge;
char cTmp[20];
lrs_create_socket("socket0", "TCP", "RemoteHost=<ServerIp>:<ServerPort>", LrsLastArg);
lrs_set_send_timeout(0,500);
lrs_set_recv_timeout(0,iTimeOut);
lrs_set_recv_timeout2(0,iTimeOut);
lrs_send("socket0", buf_desc, LrsLastArg);
if (isReturn) {
iGetReceive = GetReceiveCharPoint("socket0");
}
lrs_close_socket("socket0");
return iGetReceive;
}
action{
...
}
调用时都是直接调用LrsSendAndReceive函数进行发送的,回放时候很正常,但是在场景运行中(1个用户)都会获取不到数据, 用抓包工具查看后只发现lrs_create_socket时有保持tcp链接的数据,但看不到lrs_send数据,故也未有lrs_receive数据,有人见过类似现象吗. |
|