diff --git a/include/wx/msw/private/sockmsw.h b/include/wx/msw/private/sockmsw.h index 91dbbede2a..b79aa8e094 100644 --- a/include/wx/msw/private/sockmsw.h +++ b/include/wx/msw/private/sockmsw.h @@ -34,6 +34,8 @@ #define wxIoctlSocketArg_t u_long #endif +#define wxCloseSocket closesocket + // ---------------------------------------------------------------------------- // MSW-specific socket implementation // ---------------------------------------------------------------------------- diff --git a/include/wx/unix/private/sockunix.h b/include/wx/unix/private/sockunix.h index 3c0101ee29..05d043d354 100644 --- a/include/wx/unix/private/sockunix.h +++ b/include/wx/unix/private/sockunix.h @@ -23,6 +23,8 @@ #include "wx/private/fdiomanager.h" +#define wxCloseSocket close + class wxSocketImplUnix : public wxSocketImpl, public wxFDIOHandler { @@ -64,7 +66,7 @@ private: { DisableEvents(); - close(m_fd); + wxCloseSocket(m_fd); } virtual void UnblockAndRegisterWithEventLoop() wxOVERRIDE diff --git a/src/common/socket.cpp b/src/common/socket.cpp index 207b3c9751..eb971f952f 100644 --- a/src/common/socket.cpp +++ b/src/common/socket.cpp @@ -529,7 +529,7 @@ wxSocketImpl *wxSocketImpl::Accept(wxSocketBase& wxsocket) WX_SOCKLEN_T fromlen = sizeof(from); const wxSOCKET_T fd = accept(m_fd, &from.addr, &fromlen); - wxScopeGuard closeSocket = wxMakeGuard(wxClose, fd); + wxScopeGuard closeSocket = wxMakeGuard(wxCloseSocket, fd); // accepting is similar to reading in the sense that it resets "ready for // read" flag on the socket diff --git a/src/msw/sockmsw.cpp b/src/msw/sockmsw.cpp index 2a66c8eda4..4dbd6a6b4e 100644 --- a/src/msw/sockmsw.cpp +++ b/src/msw/sockmsw.cpp @@ -310,7 +310,7 @@ void wxSocketImplMSW::DoClose() { wxSocketManager::Get()->Uninstall_Callback(this); - closesocket(m_fd); + wxCloseSocket(m_fd); } wxSocketError wxSocketImplMSW::GetLastError() const