diff --git a/src/lib.rs b/src/lib.rs index aae9d660..7a5ccb9f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -447,6 +447,21 @@ impl Context { Ok(()) } + /// Get the maximum number of sockets allowed on the context. + pub fn get_max_sockets(&self) -> Result { + let rc = + zmq_try!(unsafe { zmq_sys::zmq_ctx_get(self.raw.ctx, zmq_sys::ZMQ_MAX_SOCKETS as _) }); + Ok(rc as i32) + } + + /// Set the maximum number of sockets allowed on the context. + pub fn set_max_sockets(&self, value: i32) -> Result<()> { + zmq_try!(unsafe { + zmq_sys::zmq_ctx_set(self.raw.ctx, zmq_sys::ZMQ_MAX_SOCKETS as _, value as i32) + }); + Ok(()) + } + /// Create a new socket. /// /// Note that the returned socket keeps a an `Arc` reference to