Avoid EADDRINUSE for s_server.

Submitted by:
Reviewed by:
PR:
This commit is contained in:
Bodo Möller 1999-04-02 23:35:43 +00:00
parent a0960a1d5b
commit cf897932ca

View file

@ -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