X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2Fstlplus%2Fportability%2Fip_sockets.cpp;h=d5d40dedec7b470c49387c1182c81b591e20f615;hp=6dc1fada2bb40ccb29e5b4baa9a7da6d6f96b169;hb=4f6e4488a55f7e3ba3f7485d78177f793c0eab9a;hpb=6b0a0d0efafe34d48ab344fca3b479553bd4e62c diff --git a/src/stlplus/portability/ip_sockets.cpp b/src/stlplus/portability/ip_sockets.cpp index 6dc1fad..d5d40de 100644 --- a/src/stlplus/portability/ip_sockets.cpp +++ b/src/stlplus/portability/ip_sockets.cpp @@ -2,7 +2,7 @@ // Author: Andy Rushton // Copyright: (c) Southampton University 1999-2004 -// (c) Andy Rushton 2004-2009 +// (c) Andy Rushton 2004 onwards // License: BSD License, see ../docs/license.html // Contains all the platform-specific socket handling used by the TCP and UDP classes @@ -23,10 +23,13 @@ #define IOCTL ioctlsocket #define CLOSE closesocket #define SHUT_RDWR SD_BOTH +#define SOCKLEN_T int +#define SEND_FLAGS 0 +#if _MSC_VER < 1600 // not defined before Visual Studio 10 #define EINPROGRESS WSAEINPROGRESS #define EWOULDBLOCK WSAEWOULDBLOCK #define ECONNRESET WSAECONNRESET -#define SOCKLEN_T int +#endif #else // Generic Unix includes // fix for older versions of Darwin? @@ -47,6 +50,7 @@ #define IOCTL ::ioctl #define CLOSE ::close #define SOCKLEN_T socklen_t +#define SEND_FLAGS MSG_NOSIGNAL #ifdef SOLARIS // Sun put some definitions in a different place #include @@ -495,7 +499,7 @@ namespace stlplus { if (!initialised()) return false; // send the data - this will never block but may not send all the data - int bytes = ::send(m_socket, data.c_str(), data.size(), 0); + int bytes = ::send(m_socket, data.c_str(), data.size(), SEND_FLAGS); if (bytes == SOCKET_ERROR) { set_error(ERRNO); @@ -514,13 +518,13 @@ namespace stlplus int bytes = 0; if (!address) { - bytes = ::send(m_socket, data.c_str(), data.size(), 0); + bytes = ::send(m_socket, data.c_str(), data.size(), SEND_FLAGS); } else { sockaddr saddress; convert_address(address, port, saddress); - bytes = ::sendto(m_socket, data.c_str(), data.size(), 0, &saddress, sizeof(saddress)); + bytes = ::sendto(m_socket, data.c_str(), data.size(), SEND_FLAGS, &saddress, sizeof(saddress)); } if (bytes == SOCKET_ERROR) {