From 5ae57a9faa06162ab886ff92fa7cd78a0434189b Mon Sep 17 00:00:00 2001 From: Tom Early Date: Wed, 24 Apr 2019 11:44:48 -0700 Subject: [PATCH] turned back on reuse for g2 port(s) --- QnetGateway.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/QnetGateway.cpp b/QnetGateway.cpp index c32218a..c40c04f 100644 --- a/QnetGateway.cpp +++ b/QnetGateway.cpp @@ -352,11 +352,11 @@ int CQnetGateway::open_port(const SPORTIP &pip, int family) } fcntl(sock, F_SETFL, O_NONBLOCK); - // int reuse = 1; - // if (::setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&reuse, sizeof(reuse)) == -1) { - // printf("Cannot set the UDP socket (port %u) option, err: %d, %s\n", pip.port, errno, strerror(errno)); - // return -1; - // } + int reuse = 1; + if (::setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&reuse, sizeof(reuse)) == -1) { + printf("Cannot set the UDP socket (port %u) option, err: %d, %s\n", pip.port, errno, strerror(errno)); + return -1; + } if (bind(sock, sin.GetPointer(), sizeof(struct sockaddr_storage)) != 0) { printf("Failed to bind %s:%d, errno=%d, %s\n", pip.ip.c_str(), pip.port, errno, strerror(errno));