51Testing软件测试论坛
标题:
求助,用socket 一个lrs_receive 要用10秒的时间
[打印本页]
作者:
zxdplay
时间:
2010-5-19 01:46
标题:
求助,用socket 一个lrs_receive 要用10秒的时间
前一张贴编辑有错误,现在重新发一贴
服务器建在本机每2秒send()一次
客户端连续接收10次,接收完关闭套接口
每次lrs_receive差不多要用十秒时间
5次receive平均响应时间为10.171秒
不知道为什么会这么慢?
vuser_init()
{
lrs_startup(257);
lrs_create_socket("socket0", "TCP", "RemoteHost=zxd-com:6050", LrsLastArg);
return 0;
}
Action()
{
int i=0;
for(i=0;i<5;i++){
lrs_receive("socket0", "buf0", LrsLastArg);
}
return 0;
}
vuser_end()
{
lrs_cleanup();
return 0;
}
//以下是录制日志
/* New recording mechanism */
00:46:22.140 /* Start section (Action) */
00:46:22.765 /* WSAStartup(): process 5992 using flags 0 */
00:46:22.765 /* ReadCommWindowInfo: HttpInterceptMode = 0 */
00:46:22.781 /* socket(): created with handle: 5992:208, address format 2, type 1, protocol 0. */
00:46:22.781 /* setsockopt(): socket 5992:208, level: 0xffff, optname: 0x1002, optval: 5120 */
00:46:22.796 /* connect(): socket 5992:208 tried to connect with family 2, port 6050, and address 0xc0a80002. Return value: 0 */
00:46:25.812 /* recv(): 1024 bytes were received from socket 5992:208 using flags 0 (5120 were asked for) */
(recv_0, 5120, 208)
"\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02"
"\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02"
"\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02"
"\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02"
"\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02"
。。。。。。。。。。。。。。。。。
作者:
zxdplay
时间:
2010-5-19 09:55
已经发现原因了,是接收缓冲区不匹配造成的!
作者:
dennyqiang
时间:
2010-5-19 10:19
把数字的大小直接改成 * 即可,见
http://bbs.51testing.com/thread-174081-1-1.html
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2