/* If socket has been created, shutdown it */
if (m_fd != INVALID_SOCKET)
{
- shutdown(m_fd, 2);
+ shutdown(m_fd, 1 /* SD_SEND */);
Close();
}
/* 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,
// 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
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.
*/