diff options
Diffstat (limited to 'common/network/TcpSocket.cxx')
-rw-r--r-- | common/network/TcpSocket.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/common/network/TcpSocket.cxx b/common/network/TcpSocket.cxx index 3b656cd7..99895ad8 100644 --- a/common/network/TcpSocket.cxx +++ b/common/network/TcpSocket.cxx @@ -440,11 +440,6 @@ TcpListener::TcpListener(const struct sockaddr *listenaddr, } #endif /* defined(IPV6_V6ONLY) */ - if (bind(sock, &sa.u.sa, listenaddrlen) == -1) { - closesocket(sock); - throw SocketException("failed to bind socket", errorNumber); - } - #ifndef WIN32 // - By default, close the socket on exec() fcntl(sock, F_SETFD, FD_CLOEXEC); @@ -457,6 +452,11 @@ TcpListener::TcpListener(const struct sockaddr *listenaddr, } #endif + if (bind(sock, &sa.u.sa, listenaddrlen) == -1) { + closesocket(sock); + throw SocketException("failed to bind socket", errorNumber); + } + // - Set it to be a listening socket if (listen(sock, 5) < 0) { int e = errorNumber; |