51Testing软件测试论坛
标题:
window-socket,收到数据部匹配问题(Mismatch )
[打印本页]
作者:
shenhuanyu09
时间:
2013-4-27 18:57
标题:
window-socket,收到数据部匹配问题(Mismatch )
我现在做一个循环,不断接收服务器信息
// 自定义一个接收函数-------------
int custom_lrs_receive(char *sock_desc, char *buf_desc,void *dummy){
int rc;
char *bufff;
int num;
int mmm;
char temps[100];
rc=lrs_receive_ex(sock_desc, buf_desc, "NumberOfBytesToRecv=4", LrsLastArg);
if (rc != 0) //正常情况下函数返回为0,非0表示函数有错误
{
lr_error_message("Receive 4 bytes failed. The error code = %d", rc);
return -1;
} /* Receive failed */
lrs_get_last_received_buffer(sock_desc,&bufff, &num);
lr_output_message("接收的长度:%d", num);
if (bufff == NULL|| num!=4)
{
lr_error_message("receive of %s failed", buf_desc);
return -1;
}
mmm=*((int*)bufff);
lrs_free_buffer(bufff);
lr_output_message("选择国家接收到的长度))))):%d", mmm);
sprintf(temps,"NumberOfBytesToRecv=%d",mmm);
rc=lrs_receive_ex(sock_desc, buf_desc, temps, LrsLastArg);
if (rc != 0) /* Receive failed */
return -1;
}
action{
int i=0;
while(i=0){
custom_lrs_receive("socket0","buf8",LrsLastArg);
lrs_get_last_received_buffer("socket0",&ActualBuffer, &NumberOfBytes);
}
}
1、用while不断接收服务器推送
2、custom_lrs_receive方法来实现实际接受数据长度不一的问题
我想让他一直循环下去,他妹的,前几句还正常,后面的会弹出
Action.c(279): Mismatch in buffer's length (expected 4 bytes, 0 bytes actually received, difference in 4 bytes)
Action.c(279): Error : socket0 - Connection refused. Error code : 10061.
问题一:怎么样把这个这个mismatch问题给处理掉
问题二:怎么实现一直接收服务器的信息
很有技术含量的问题,请高手不吝赐教,小子坐等.........
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2