table of contents
NNG_SOCKET_SET(3) | NNG Reference Manual | NNG_SOCKET_SET(3) |
NAME¶
nng_socket_set - set socket option
SYNOPSIS¶
#include <nng/nng.h> int nng_socket_set(nng_socket s, const char *opt, const void *val, size_t valsz); int nng_socket_set_bool(nng_socket s, const char *opt, bool bval); int nng_socket_set_int(nng_socket s, const char *opt, int ival); int nng_socket_set_ms(nng_socket s, const char *opt, nng_duration dur); int nng_socket_set_ptr(nng_socket s, const char *opt, void *ptr); int nng_socket_set_size(nng_socket s, const char *opt, size_t z); int nng_socket_set_string(nng_socket s, const char *opt, const char *str); int nng_socket_set_uint64(nng_socket s, const char *opt, uint64_t u64);
DESCRIPTION¶
The nng_socket_set() functions are used to configure options for the socket s. The actual options that may be configured in this way vary, and are specified by opt. A number of them are documented in nng_options(5).
Protocol-specific options are documented with the protocol in question.
Important
Access to transport options via this function is deprecated, and
may be
removed from a future release. Applications should instead make use of
nng_dialer_get or nng_listener_get for specific dialers or listeners.
Forms¶
The details of the type, size, and semantics of the option will depend on the actual option, and is documented with the option itself.
nng_socket_set()
Tip
It may be easier to use one of the typed forms of this function.
nng_socket_set_bool()
nng_socket_set_int()
nng_socket_set_ms()
nng_socket_set_ptr()
Note
This form is somewhat special in that the object is generally
not copied, but instead the pointer to the object is copied.
nng_socket_set_size()
nng_socket_set_string()
nng_socket_set_uint64()
RETURN VALUES¶
These functions return 0 on success, and non-zero otherwise.
ERRORS¶
NNG_ECLOSED
NNG_EINVAL
NNG_ENOTSUP
NNG_EREADONLY
NNG_ESTATE
SEE ALSO¶
nng_socket_get(3), nng_dialer_set(3), nng_listener_set(3), nng_strerror(3), nng_options(5), nng_socket(5), nng(7)
2024-10-11 |