TA的每日心情 | 慵懒 2015-5-22 10:32 |
---|
签到天数: 1 天 连续签到: 1 天 [LV.1]测试小兵
|
5#
楼主 |
发表于 2011-3-30 09:14:00
|
只看该作者
本帖最后由 wuliangye 于 2011-3-30 09:15 编辑
代码如下:
int g_nSocketID = 0;
#define MAX_SocketExist_SECOND 5
Action()
{
sprintf(strSocketName, "Socket%d", g_nSocketID++);
time(&nStartTime[g_nSocketID]);
lrs_create_socket(strSocketName, "TCP", "LocalHost=0", "RemoteHost=<RemoteHost>:554", LrsLastArg);
//wati until 100 devices coming
lr_rendezvous("100_Devices_Store");
lrs_send(strSocketName, "buf0", LrsLastArg);
lrs_receive(strSocketName, "buf1", LrsLastArg);
lrs_send(strSocketName, "buf2", LrsLastArg);
lrs_receive(strSocketName, "buf3", LrsLastArg);
lrs_send(strSocketName, "buf4", LrsLastArg);
lrs_receive(strSocketName, "buf5", LrsLastArg);
lrs_save_searched_string(strSocketName, NULL, "newsession", "LB/BIN=Session: ", "RB/BIN=\r\n", 1, 0, -1); //每次错误都出在这里
lrs_send(strSocketName, "buf6", LrsLastArg);
lrs_receive(strSocketName, "buf7", LrsLastArg);
lrs_send(strSocketName, "buf8", LrsLastArg);
lrs_receive(strSocketName,"buf9",LrsLastArg);
time(&nCurrentTime[g_nSocketID]);
if ((nCurrentTime[g_nSocketID++] - nStartTime[g_nSocketID++]) >= MAX_SocketExist_SECOND) {
lrs_send(strSocketName, "buf10", LrsLastArg);
lrs_receive(strSocketName, "buf10", LrsLastArg);
}
} |
|