From bb67a9767078bd98add53ead0e0e2f1390cfb539 Mon Sep 17 00:00:00 2001 From: gdamore Date: Thu, 2 Jan 2025 03:17:48 +0000 Subject: deploy: f7bf24f429cbc488b861ab1b1e4cf1983af56295 --- ref/api/memory.html | 4 +--- ref/api/sock.html | 58 +++++++++-------------------------------------------- 2 files changed, 11 insertions(+), 51 deletions(-) (limited to 'ref/api') diff --git a/ref/api/memory.html b/ref/api/memory.html index 9fa8b5bd..32319564 100644 --- a/ref/api/memory.html +++ b/ref/api/memory.html @@ -234,9 +234,7 @@ The memory will be 64-bit aligned. Note that the memory may have random data in it, just like with malloc.

If memory cannot be allocated for any reason, then NULL will be returned. Applications that experience this should treat this like NNG_ENOMEM.

-

Memory returned by nng_alloc can be used to hold message buffers, in which -case it can be directly passed to nng_send using the flag NNG_FLAG_ALLOC. -Alternatively, it can be freed when no longer needed using nng_free.

+

Memory returned by nng_alloc should be freed when no longer needed using nng_free.

diff --git a/ref/api/sock.html b/ref/api/sock.html index 5ac982b7..215726e0 100644 --- a/ref/api/sock.html +++ b/ref/api/sock.html @@ -381,19 +381,9 @@ while SUB sockets can only receive data and never It sends the content in data, as a message of size bytes. The flags is a bit mask made up of zero or more of the following values:

@@ -406,15 +396,6 @@ Furthermore, there is no guarantee that the message has actually been delivered. Finally, with some protocols, the semantic is implicitly NNG_FLAG_NONBLOCK, such as with PUB sockets, which are best-effort delivery only.

-
-

- - important -

-

When using NNG_FLAG_ALLOC, it is important that the value of size match the actual allocated size of the data. -Using an incorrect size results in unspecified behavior, which may include heap corruption, program crashes, -or other undesirable effects.

-

nng_sendmsg

The nng_sendmsg function sends the msg over the socket s.

If this function returns zero, then the socket will dispose of msg when the transmission is complete. @@ -451,7 +432,7 @@ this function instead of nng_send int nng_recvmsg(nng_socket s, nng_msg **msgp, int flags); void nng_recv_aio(nng_socket s, nng_aio *aio); -

These functions (nng_recv, nng_recvmsg, and nng_recv_aio) receive +

These functions (nng_recv, nng_recvmsg, and nng_recv_aio) receive messages over the socket s. The differences in their behaviors are as follows.

@@ -466,33 +447,14 @@ while PUB sockets can only send data and never rec

nng_recv

The nng_recv function is the simplest to use, but is the least efficient. -It receives the content in data, as a message size (in bytes) of up to the value stored in sizep, -unless the NNG_FLAG_ALLOC flag is set in flags (see below.)

+It receives the content in data, as a message size (in bytes) of up to the value stored in sizep.

Upon success, the size of the message received will be stored in sizep.

The flags is a bit mask made up of zero or more of the following values:

-
-

- - important -

-

When using NNG_FLAG_ALLOC, it is important that the value of size match the actual allocated size of the data. -Using an incorrect size results in unspecified behavior, which may include heap corruption, program crashes, -or other undesirable effects.

-

nng_recvmsg

The nng_recvmsg function receives a message and stores a pointer to the nng_msg for that message in msgp.

The flags can contain the value NNG_FLAG_NONBLOCK, indicating that the function should not wait if the socket @@ -503,7 +465,7 @@ has no messages available to receive. In such a case, it will return nng_recv, as it gives access to the message structure and eliminates both -a data copy and allocation, even when nng_recv is using NNG_FLAG_ALLOC.

+a data copy and allocation.

nng_recv_aio

The nng_send_aio function receives a message asynchronously, using the nng_aio aio, over the socket s. @@ -530,12 +492,12 @@ this function instead of nng_recv or

Sometimes it is necessary to integrate a socket into a poll or select driven -event loop. (Or, on Linux, epoll, or on BSD derived systems like macOS kqueue).

+event loop. (Or, on Linux, epoll, or on BSD derived systems like macOS kqueue).

For these occasions, a suitable file descriptor for polling is provided by these two functions.

-

The nng_socket_get_recv_poll_fd function obtains a file descriptor +

The nng_socket_get_recv_poll_fd function obtains a file descriptor that will poll as readable when a message is ready for receiving for the socket.

-

The nng_socket_get_send_poll_fd function obtains a file descriptor +

The nng_socket_get_send_poll_fd function obtains a file descriptor that will poll as readable when the socket can accept a message for sending.

These file descriptors should only be polled for readability, and no other operation performed on them. The socket will read from, or write to, -- cgit v1.2.3-70-g09d2