diff -r fe4088d5573a -r 9334c8280602 sin_util.c --- a/sin_util.c Tue Dec 10 15:51:32 2019 +0000 +++ b/sin_util.c Tue Dec 10 16:07:49 2019 +0000 @@ -153,6 +153,10 @@ if ((type = gettypebyname(protocol)) == SOCK_PACKET) return -1; /* create the socket */ if ((s = socket(PF_INET, type, 0)) < 0) {perror("socket()"); return -1;} + if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &(int){ 1 }, sizeof(int)) < 0) { + perror("setsockopt(SO_REUSEADDR) failed"); + return -1; + } /* bind the socket */ if (bind(s, (struct sockaddr *)&sin, sizeof (sin)) < 0) {perror("bind()"); return -1;}