xs_setctxopt(3) =============== NAME ---- xs_setctxopt - set Crossroads context options SYNOPSIS -------- *int xs_setctxopt (void '*context', int 'option_name', const void '*option_value', size_t 'option_len');* Caution: All options take effect only if set prior to creating the first socket. DESCRIPTION ----------- The _xs_setctxopt()_ function shall set the option specified by the 'option_name' argument to the value pointed to by the 'option_value' argument for the Crossroads context pointed to by the 'context' argument. The 'option_len' argument is the size of the option value in bytes. The following options can be set with the _xs_setctxopt()_ function: XS_CTX_MAX_SOCKETS: Set maximum number of sockets ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The 'XS_CTX_MAX_SOCKETS' option shall set specify the maximum nuber of sockets that can be open at the same time. [horizontal] Option value type:: int Option value unit:: sockets Default value:: 512 XS_CTX_REENTRANT: Specify whether sockets should be thread-safe ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If 'XS_CTX_REENTRANT' option is set to 1 it is safe to access single Crossroads socket from multiple threads in parallel. If it is set to 0 it can be accessed by at most one thread at any single point of time. Note: By default Crossroads sockets are non-reentrant. If possible, try to use the socket from the thread it was created in. If communication between threads is needed use inproc transport. Not following this advice can introduce scalability problems. [horizontal] Option value type:: int Option value unit:: boolean Default value:: 0 RETURN VALUE ------------ The _xs_setctxopt()_ function shall return zero if successful. Otherwise it shall return `-1` and set 'errno' to one of the values defined below. ERRORS ------ *EINVAL*:: The requested option _option_name_ is unknown, or the requested _option_len_ or _option_value_ is invalid. *EFAULT*:: The provided 'context' was invalid. EXAMPLE ------- .Setting maximal number of sockets to three. ---- int val = 3; rc = xs_setctxopt (context, XS_CTX_MAX_SOCKETS, &val, sizeof (val)); assert (rc == 0); ---- SEE ALSO -------- linkxs:xs_getsockopt[3] linkxs:xs_setsockopt[3] linkxs:xs_init[3] linkxs:xs[7] AUTHORS ------- This manual page was written by Martin Sustrik .