Avoid EADDRINUSE for s_server.
Submitted by: Reviewed by: PR:
This commit is contained in:
parent
a0960a1d5b
commit
cf897932ca
1 changed files with 6 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue