提交 cf897932 编写于 作者: B Bodo Möller

Avoid EADDRINUSE for s_server.

Submitted by:
Reviewed by:
PR:
上级 a0960a1d
......@@ -342,6 +342,12 @@ char *ip;
s=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL);
if (s == INVALID_SOCKET) goto err;
#if defined SOL_SOCKET && defined SO_REUSEADDR
{
int i = 1;
setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &i, sizeof i);
}
#endif
if (bind(s,(struct sockaddr *)&server,sizeof(server)) == -1)
{
#ifndef WINDOWS
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册