summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorunknown <bundra@.(none)>2009-12-10 10:39:24 +0100
committerunknown <bundra@.(none)>2009-12-10 10:39:24 +0100
commit986ab66b8f260614b2bd18f870ad98402c0f247a (patch)
tree2874d2607c807503aeca83379fe5c3b1003db104 /src
parent8d58643655b653c520fcdcc2a89b5067788f32fc (diff)
ZMQII-27: Allow setting SNDBUF and RCVBUF size from 0MQ API (Win32)
Diffstat (limited to 'src')
-rw-r--r--src/tcp_socket.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/tcp_socket.cpp b/src/tcp_socket.cpp
index 6df9ef6..5c7d60d 100644
--- a/src/tcp_socket.cpp
+++ b/src/tcp_socket.cpp
@@ -38,6 +38,21 @@ int zmq::tcp_socket_t::open (fd_t fd_, uint64_t sndbuf_, uint64_t rcvbuf_)
{
zmq_assert (s == retired_fd);
s = fd_;
+
+ if (sndbuf_) {
+ int sz = (int) sndbuf_;
+ int rc = setsockopt (s, SOL_SOCKET, SO_SNDBUF,
+ (char*) &sz, sizeof (int));
+ errno_assert (rc == 0);
+ }
+
+ if (rcvbuf_) {
+ int sz = (int) rcvbuf_;
+ int rc = setsockopt (s, SOL_SOCKET, SO_RCVBUF,
+ (char*) &sz, sizeof (int));
+ errno_assert (rc == 0);
+ }
+
return 0;
}