Use SO_REUSEADDR socket option to allow binding after ^C.

pull/1/head
Peter Zotov 2011-02-15 19:47:45 +03:00
rodzic db2744519e
commit db0a8d3ddf
1 zmienionych plików z 3 dodań i 0 usunięć

Wyświetl plik

@ -52,6 +52,9 @@ int serve(struct stlink* sl, int port) {
return 1;
}
unsigned int val = 1;
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
struct sockaddr_in serv_addr = {0};
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = INADDR_ANY;