Set SO_REUSEADDR on the server socket.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 6 Apr 2013 14:55:16 +0000 (16:55 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 6 Apr 2013 14:55:16 +0000 (16:55 +0200)
cubemap.cpp

index 98db848152a380b9a279f4ac29e57ceedcf0a8d0..4ee5d6f3c4d6a95fcc5dfc556a437b5cf2077a76 100644 (file)
@@ -35,6 +35,12 @@ int create_server_socket(int port)
                exit(1);
        }
 
+       int one;        
+       if (setsockopt(server_sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)) == -1) {
+               perror("setsockopt(SO_REUSEADDR)");
+               exit(1);
+       }
+
        // We want dual-stack sockets. (Sorry, OpenBSD and Windows XP...)
        int zero = 0;
        if (setsockopt(server_sock, IPPROTO_IPV6, IPV6_V6ONLY, &zero, sizeof(zero)) == -1) {