X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b74865fa61c17c45f65d9f59befc52516e41c9c7..5064e6eff3ca35cb20130dc9e5e53fb3ac02127e:/src/msw/gsocket.cpp diff --git a/src/msw/gsocket.cpp b/src/msw/gsocket.cpp index 0bbfea6275..2edc3ab247 100644 --- a/src/msw/gsocket.cpp +++ b/src/msw/gsocket.cpp @@ -222,7 +222,7 @@ void GSocket::Shutdown() /* If socket has been created, shutdown it */ if (m_fd != INVALID_SOCKET) { - shutdown(m_fd, 2); + shutdown(m_fd, 1 /* SD_SEND */); Close(); } @@ -399,8 +399,9 @@ GSocketError GSocket::SetServer() /* allow a socket to re-bind if the socket is in the TIME_WAIT state after being previously closed. */ - if (m_reusable) { - setsockopt(m_fd, SOL_SOCKET, SO_REUSEADDR, (const char*)&arg, sizeof(u_long)); + if (m_reusable) + { + setsockopt(m_fd, SOL_SOCKET, SO_REUSEADDR, (const char*)&arg, sizeof(arg)); } /* Bind to the local address, @@ -596,7 +597,7 @@ GSocketError GSocket::Connect(GSocketStream stream) // If the reuse flag is set, use the applicable socket reuse flag if (m_reusable) { - setsockopt(m_fd, SOL_SOCKET, SO_REUSEADDR, (const char*)&arg, sizeof(u_long)); + setsockopt(m_fd, SOL_SOCKET, SO_REUSEADDR, (const char*)&arg, sizeof(arg)); } // If a local address has been set, then we need to bind to it before calling connect @@ -701,6 +702,11 @@ GSocketError GSocket::SetNonOriented() ioctlsocket(m_fd, FIONBIO, (u_long FAR *) &arg); gs_gui_functions->Enable_Events(this); + if (m_reusable) + { + setsockopt(m_fd, SOL_SOCKET, SO_REUSEADDR, (const char*)&arg, sizeof(arg)); + } + /* Bind to the local address, * and retrieve the actual address bound. */ @@ -864,9 +870,9 @@ GSocketEventFlags GSocket::Select(GSocketEventFlags flags) result |= GSOCK_INPUT_FLAG; if (m_server && m_stream) - { - /* This is a TCP server socket that detected a connection. - While the INPUT_FLAG is also set, it doesn't matter on + { + /* This is a TCP server socket that detected a connection. + While the INPUT_FLAG is also set, it doesn't matter on this kind of sockets, as we can only Accept() from them. */ result |= GSOCK_CONNECTION_FLAG; m_detected |= GSOCK_CONNECTION_FLAG;