On posix systems, set SO_REUSEADDR

This commit is contained in:
baldurk
2016-07-13 13:54:25 +02:00
parent d5fd26f267
commit 28c6105215
+3
View File
@@ -226,6 +226,9 @@ Socket *CreateServerSocket(const char *bindaddr, uint16_t port, int queuesize)
{
int s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
int yes = 1;
setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes));
if(s == -1)
return NULL;