Man page - nng_recv(3)
Packages contains this manual
- nng_inproc(7)
- nng_msg_header(3)
- nng_push_open(3)
- nng_ipc_options(5)
- nng_bus_open(3)
- nng_tls_options(5)
- nng_aio_result(3)
- nng_pipe_socket(3)
- nng_msg(5)
- nng_stat_child(3)
- nng_pipe_get(3)
- nng_dialer_close(3)
- nng_tcp_register(3)
- nng_url_clone(3)
- nng_msg_free(3)
- nng_dialer_set(3)
- nng_sockaddr_zt(5)
- nng_pull(7)
- nng_stat_unit(3)
- nng_wss_register(3)
- nng_socket_proto_id(3)
- nng_ws_register(3)
- nng_pull_open(3)
- nng_stat_type(3)
- nng_stat_next(3)
- nng_listener_close(3)
- nng_setopt(3)
- nng_msg_insert(3)
- nng_aio_cancel(3)
- nng_listener_set(3)
- nng_msg_realloc(3)
- nng_log(3)
- nng_duration(5)
- nng_options(5)
- nng_strfree(3)
- nng_device(3)
- nng_msg_header_insert(3)
- nng_stat_find_listener(3)
- nng_stat_bool(3)
- nng_aio_set_timeout(3)
- nng_iov(5)
- nng_listener_setopt(3)
- nng_pipe_dialer(3)
- nng_msg_append(3)
- nng_aio_finish(3)
- nng_ws(7)
- nng_stream_listener(5)
- nng_aio_set_output(3)
- nng_ctx_get(3)
- nng_stat_find(3)
- nng_dialer_create(3)
- nng_dialer_getopt(3)
- nng_msg_header_len(3)
- nng_sendmsg(3)
- nng_listener_start(3)
- nng_socket(5)
- nng_str_sockaddr(3)
- nng_dialer_id(3)
- nng_msg_alloc(3)
- nng_recv_aio(3)
- nng_stats_free(3)
- nng_listener_getopt(3)
- nng_recvmsg(3)
- nng_ctx_getopt(3)
- nng_ctx_close(3)
- nng_alloc(3)
- nng_stat_string(3)
- nng(7)
- nng_listener_id(3)
- nng_msg_get_pipe(3)
- nng_aio_get_output(3)
- nng_pipe_getopt(3)
- nng_tcp(7)
- nng_pipe_notify(3)
- libnng(3)
- nng_stats_get(3)
- nng_surveyor_open(3)
- nng_aio_defer(3)
- nng_aio_count(3)
- nng_msg_chop(3)
- nng_sockaddr_abstract(5)
- nng_pipe_id(3)
- nng_msg_header_trim(3)
- nng_stream_dialer(5)
- nng_url_parse(3)
- nng_send(3)
- nng_tls_config(5)
- nng_strerror(3)
- nng_req(7)
- nng_dialer_setopt(3)
- nng_ctx(5)
- nng_respondent(7)
- nng_aio_begin(3)
- nng_dialer_get(3)
- nng_pipe_close(3)
- nng_aio_wait(3)
- nng_tcp_options(5)
- nng_ctx_id(3)
- nng_version(3)
- nng_dial(3)
- nng_stat_timestamp(3)
- nng_ipc_register(3)
- nng_stat_find_socket(3)
- nng_aio_set_iov(3)
- nng_rep(7)
- nng_msg_header_chop(3)
- nng_stat_find_dialer(3)
- nng_listener_get(3)
- nng_url(5)
- nng_zt_register(3)
- nng_zerotier(7)
- nng_req_open(3)
- nng_log_set_facility(3)
- nng_sub(7)
- nng_inproc_register(3)
- nng_listener_create(3)
- nng_aio_set_input(3)
- nng_stat_value(3)
- nng_aio_alloc(3)
- nng_ctx_open(3)
- nng_msg_len(3)
- nng_sockaddr_in(5)
- nng_ipc(7)
- nng_aio_get_input(3)
- nng_tls(7)
- nng_socket_raw(3)
- nng_sockaddr_inproc(5)
- nng_dialer_start(3)
- nng_surveyor(7)
- nng_close(3)
- nng_pub_open(3)
- nng_stream(5)
- nng_msg_set_pipe(3)
- nng_aio(5)
- nng_aio_stop(3)
- nng_pipe(5)
- nng_aio_free(3)
- nng_free(3)
- nng_sockaddr_ipc(5)
- nng_log_set_logger(3)
- nng_url_free(3)
- nng_listen(3)
- nng_aio_set_msg(3)
- nng_respondent_open(3)
- nng_rep_open(3)
- nng_getopt(3)
- nng_msg_body(3)
- nng_listener(5)
- nng_log_set_level(3)
- nng_pipe_listener(3)
- nng_aio_get_msg(3)
- nng_push(7)
- nng_socket_get(3)
- nng_ctx_set(3)
- nng_sub_open(3)
- nng_ctx_setopt(3)
- nng_socket(7)
- nng_stat(5)
- nng_tls_register(3)
- nng_sockaddr_in6(5)
- nng_aio_abort(3)
- nng_msg_dup(3)
- nng_socket_set(3)
- nng_send_aio(3)
- nng_recv(3)
- nng_pair(7)
- nng_sockaddr(5)
- nng_ctx_recv(3)
- nng_pair_open(3)
- nng_msg_clear(3)
- nng_sleep_aio(3)
- nng_stat_desc(3)
- nng_dialer(5)
- nng_strdup(3)
- nng_ctx_send(3)
- nng_msg_header_append(3)
- nng_msg_header_clear(3)
- nng_socket_proto_name(3)
- nng_socket_id(3)
- nng_log_get_level(3)
- nng_tls_engine(5)
- nng_pub(7)
- nng_stat_name(3)
- nng_msg_trim(3)
- nng_bus(7)
apt-get install libnng-dev
Manual
NNG_RECV
NAMESYNOPSIS
DESCRIPTION
RETURN VALUES
ERRORS
SEE ALSO
NAME
nng_recv - recv data
SYNOPSIS
#include <nng/nng.h>
int nng_recv(nng_socket s, void *data, size_t *sizep, int flags);
DESCRIPTION
The nng_recv() receives a message.
The flags is a bit mask that may contain any of the following values:
NNG_FLAG_NONBLOCK
The function returns immediately, even if no message is available. Without this flag, the function will wait until a message is received by the socket s , or any configured timer expires.
NNG_FLAG_ALLOC
If this flag is present, then a zero-copy mode is used. In this case the caller must set the value of data to the location of another pointer (of type void *), and the sizep pointer must be set to a location to receive the size of the message body. The function will then allocate a message buffer (as if by nng_alloc()), fill it with the message body, and store it at the address referenced by data , and update the size referenced by sizep . The caller is responsible for disposing of the received buffer either by the nng_free() function or passing the message (also with the NNG_FLAG_ALLOC flag) in a call to nng_send().
If the special flag NNG_FLAG_ALLOC (see above) is not specified, then the caller must set data to a buffer to receive the message body content, and must store the size of that buffer at the location pointed to by sizep . When the function returns, if it is successful, the size at sizep will be updated with the actual message body length copied into data .
Note
The NNG_FLAG_ALLOC flag is deprecated and may be removed in a future release. Applications should use nng_recvmsg() for zero copy performance improvements.
Note
The semantics of what receiving a message means vary from protocol to protocol, so examination of the protocol documentation is encouraged. (For example, with a req socket a message may only be received after a request has been sent, and a sub socket may only receive messages corresponding to topics to which it has subscribed.) Furthermore, some protocols may not support receiving data at all, such as pub .
RETURN VALUES
This function returns 0 on success, and non-zero otherwise.
ERRORS
NNG_EAGAIN
The operation would block, but NNG_FLAG_NONBLOCK was specified.
NNG_ECLOSED
The socket s is not open.
NNG_EINVAL
An invalid set of flags was specified.
NNG_EMSGSIZE
The received message did not fit in the size provided.
NNG_ENOMEM
Insufficient memory is available.
NNG_ENOTSUP
The protocol for socket s does not support receiving.
NNG_ESTATE
The socket s cannot receive data in this state.
NNG_ETIMEDOUT
The operation timed out.
SEE ALSO
nng_alloc(3), nng_free(3), nng_recvmsg(3), nng_send(3), nng_strerror(3), nng(7)