summaryrefslogtreecommitdiff
path: root/src/ip.cpp
diff options
context:
space:
mode:
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
+}
+