|
4#
楼主 |
发表于 2012-2-8 14:54:18
|
只看该作者
我现在将脚本改成了如下:
奇迹的是不报超时了,但是会提示收到的消息长度不匹配(因为我无法判断收到的消息长度,所以我也不知道怎弄)
Mismatch (expected 1 bytes, 2133 bytes actually received)
这行提示信息虽说不影响测试结果,但是看着不爽啊。。
请高人指点下。。。如何优化
#include "lrs.h"
Action()
{
/*与网关建立Socket*/
int sc =0;
int i=0;
lrs_create_socket("socket0", "TCP", "RemoteHost=10.1.91.36:5001", LrsLastArg);
if(sc == 0)
lr_output_message("Socket was successfully created!");
else
lr_output_message("An error occurred while creating the socket,Error Code: %d",sc);
//连接初始化请求0x11
lrs_send("socket0", "buf1", LrsLastArg);
//发送测试订阅行情到行情网关0x21
lrs_send("socket0", "buf2", LrsLastArg);
//think time
lr_think_time(0.3);
while(1)
{
lr_start_transaction("test");
//向网关发送心跳
lrs_send("socket0", "buf0", LrsLastArg);
lrs_set_receive_option(EndMarker, EndMarker_None);
//客户端接收行情数据
lrs_receive("socket0", "buf3", LrsLastArg);
lr_end_transaction("test", LR_PASS);
//think time
lr_think_time(0.3);
}
return 0;
} |
|