From d5f3628ad08849a0c978f7d23dc678133ed33c42 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Fri, 29 Jul 2011 09:37:43 +0200 Subject: Different connecters simplified Signed-off-by: Martin Sustrik --- src/ip.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/ip.cpp') diff --git a/src/ip.cpp b/src/ip.cpp index e643663..7c08373 100644 --- a/src/ip.cpp +++ b/src/ip.cpp @@ -28,6 +28,18 @@ #include "platform.hpp" #include "stdint.hpp" +#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS +#include +#endif + +#if !defined ZMQ_HAVE_WINDOWS +#include +#endif + +#if defined ZMQ_HAVE_OPENVMS +#include +#endif + #if defined ZMQ_HAVE_SOLARIS #include @@ -367,4 +379,23 @@ void zmq::tune_tcp_socket (fd_t s_) #endif } +void zmq::unblock_socket (fd_t s_) +{ +#ifdef ZMQ_HAVE_WINDOWS + u_long nonblock = 1; + int rc = ioctlsocket (s_, FIONBIO, &nonblock); + wsa_assert (rc != SOCKET_ERROR); +#elif ZMQ_HAVE_OPENVMS + int nonblock = 1; + int rc = ioctl (s_, FIONBIO, &nonblock); + errno_assert (rc != -1); +#else + int flags = fcntl (s_, F_GETFL, 0); + if (flags == -1) + flags = 0; + int rc = fcntl (s_, F_SETFL, flags | O_NONBLOCK); + errno_assert (rc != -1); +#endif +} + -- cgit v1.2.3