diff --git a/sources/network/unix/unix_tcp_socket.cpp b/sources/network/unix/unix_tcp_socket.cpp index e43b1e8..c146984 100644 --- a/sources/network/unix/unix_tcp_socket.cpp +++ b/sources/network/unix/unix_tcp_socket.cpp @@ -107,7 +107,7 @@ tcp_socket::connect(const std::string& host, std::uint32_t port, std::uint32_t t //! 1 means we are connected. //! 0/-1 means a timeout. - if (select(0, NULL, &set, NULL, &tv) == 1) { + if (select(m_fd + 1, NULL, &set, NULL, &tv) == 1) { //! Set back to blocking mode as the user of this class is expecting if (fcntl(m_fd, F_SETFL, fcntl(m_fd, F_GETFL, 0) & (~O_NONBLOCK)) == -1) { close(); diff --git a/sources/network/windows/windows_tcp_socket.cpp b/sources/network/windows/windows_tcp_socket.cpp index 2f429e0..4037184 100644 --- a/sources/network/windows/windows_tcp_socket.cpp +++ b/sources/network/windows/windows_tcp_socket.cpp @@ -88,7 +88,7 @@ tcp_socket::connect(const std::string& host, std::uint32_t port, std::uint32_t t //! 1 means we are connected. //! 0 means a timeout. - if (select(0, NULL, &set, NULL, &tv) == 1) { + if (select(static_cast(m_fd) + 1, NULL, &set, NULL, &tv) == 1) { //! Set back to blocking mode as the user of this class is expecting u_long mode = 0; if (ioctlsocket(m_fd, FIONBIO, &mode) != 0) {