windows 2k 里的listen(SOCKET s,int backlog)的第二个参数不起作用吗?
listen的原型
int listen(
SOCKET s,
int backlog
);
对backlog的说明:
[in] Maximum length of the queue of pending connections. If set to SOMAXCONN, the underlying service provider responsible for socket s will set the backlog to a maximum reasonable value. There is no standard provision to obtain the actual backlog value.
应该是可以设定接入连接数的。我用下面的代码还是可以接入。
把backlog设成1,接进多少台都没问题。请问我哪里设的有问题吗?谢谢。
if (SOCKET_ERROR == listen (s, 0))
{
printf ("Listen failed: %u\n", GetLastError ());
closesocket(s) ;
return(FALSE);
}
else
{
printf("Listening ! \n");
}