#include <nanomsg/nn.h> int nn_send(int sock, const void *data, size_t size, int flags)
|This documentation is for the TIP (development tree) of NNG and may represent unreleased changes or functionality that is experimental, and is subject to change before release. The latest released version is v1.3.2. See the documentation for v1.3.2 for the most up-to-date information.|
nn_send - send data (compatible API)
nn_send() function creates a message containing data (of size size),
and sends using the socket sock.
|This function is provided for API compatibility with legacy libnanomsg. Consider using the relevant modern API instead.|
If size has the special value
NN_MSG, then a zero-copy operation
In this case, data points not to the message content itself, but instead
is a pointer to the pointer, an extra level of pointer indirection.
The message must have been previously allocated by
, using the same `NN_MSG size.
In this case, the ownership of the message shall remain with
the caller, unless the function returns 0, indicating that the
function has taken responsibility for delivering or disposing of the
The flags field may contain the special flag
In this case, if the socket is unable to accept more data for sending,
the operation shall not block, but instead will fail with the error
|The send operation is performed asynchronously, and may not have completed before this function returns control to the caller.|
This function returns the number of bytes sent on success, and -1 on error.
The operation would block.
The socket sock is not open.
The socket cannot send in this state.
This protocol cannot send.
Operation timed out.