summaryrefslogtreecommitdiff
path: root/src/ip.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-07-29 09:37:43 +0200
committerMartin Sustrik <sustrik@250bpm.com>2011-07-29 09:37:43 +0200
commitd5f3628ad08849a0c978f7d23dc678133ed33c42 (patch)
treede82260f962d25b4762497af8358bd6182feefb4 /src/ip.cpp
parentf63db009a1e1baf9f1fe7dae39901c7449c66131 (diff)
Different connecters simplified
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/ip.cpp')
-rw-r--r--src/ip.cpp31
1 files changed, 31 insertions, 0 deletions
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 <sys/un.h>
+#endif
+
+#if !defined ZMQ_HAVE_WINDOWS
+#include <fcntl.h>
+#endif
+
+#if defined ZMQ_HAVE_OPENVMS
+#include <ioctl.h>
+#endif
+
#if defined ZMQ_HAVE_SOLARIS
#include <sys/sockio.h>
@@ -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
+}
+