diff --git a/guacd/src/daemon.c b/guacd/src/daemon.c index b0bc350f..20ef1369 100644 --- a/guacd/src/daemon.c +++ b/guacd/src/daemon.c @@ -75,6 +75,7 @@ int main(int argc, char* argv[]) { /* Server */ int socket_fd; struct sockaddr_in server_addr; + int opt_on = 1; /* Client */ struct sockaddr_in client_addr; @@ -116,6 +117,10 @@ int main(int argc, char* argv[]) { exit(EXIT_FAILURE); } + if (setsockopt(socket_fd, SOL_SOCKET, SO_REUSEADDR, &opt_on, sizeof(opt_on))) { + fprintf(stderr, "Warning: Unable to set socket options for reuse: %s\n", strerror(errno)); + } + /* Bind socket to address */ if (bind(socket_fd, (struct sockaddr*) &server_addr, sizeof(server_addr)) < 0) {