Skip to content

Commit 3427028

Browse files
committed
doc: Add section for Supported flags for socket functions
Add section for Supported flags for socket functions Signed-off-by: divya pillai <[email protected]>
1 parent ea00e74 commit 3427028

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

nrf_modem/doc/sockets/socket_options_func.rst

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,3 +372,42 @@ NRF_SO_SEC_CIPHERSUITE_USED
372372
Get chosen TLS cipher suite.
373373
This option is read-only.
374374
The socket option is supported from modem firmware v2.x.x.
375+
376+
Supported flags for socket functions
377+
************************************
378+
379+
The following flags are supported for socket functions such as :c:func:`nrf_send`, :c:func:`nrf_recv`, :c:func:`nrf_sendto`, and :c:func:`nrf_recvfrom`:
380+
381+
* :c:macro:`NRF_MSG_PEEK`
382+
Returns data from the beginning of receive queue without removing it from the input queue.
383+
This flag is only supported for the :c:func:`nrf_recv` and :c:func:`nrf_recvfrom` functions.
384+
When this flag is used, the data is copied into the provided buffer but remains in the socket's input queue for future reads.
385+
Subsequent calls to :c:func:`nrf_recv` or :c:func:`nrf_recvfrom` returns the same data until it is read without the :c:macro:`NRF_MSG_PEEK` flag.
386+
This flag is useful when an application needs to inspect incoming data without consuming it, allowing for multiple reads of the same data.
387+
The default behavior is to remove the data from the input queue after it has been read.
388+
389+
* :c:macro:`NRF_MSG_DONTWAIT`
390+
Enables non-blocking operation for this specific function call.
391+
If the operation blocks, the function returns immediately with ``-1`` and sets ``errno`` to ``NRF_EAGAIN`` or ``NRF_EWOULDBLOCK``.
392+
This flag has no effect if the socket is already set to non-blocking mode using :c:func:`nrf_fcntl`.
393+
This flag is useful when an application wants to perform a single non-blocking operation on a socket that is otherwise in blocking mode.
394+
The default behavior is to follow the socket's blocking mode.
395+
396+
* :c:macro:`NRF_MSG_WAITALL`
397+
Requests that the function blocks read operation until the full amount of data requested has been received.
398+
This flag is only supported for the :c:func:`nrf_recv` and :c:func:`nrf_recvfrom` functions.
399+
If this flag is used, the function continues to block and wait for more data until either the requested number of bytes has been received or an error occurs.
400+
If the connection is closed before all requested data is received, the function returns the number of bytes that were actually received.
401+
This flag is useful when an application needs to ensure that it receives a complete message or data block in a single operation.
402+
The default behavior is to return as soon as any data is available, even if it is less than the requested amount.
403+
404+
* :c:macro:`NRF_MSG_WAITACK`
405+
Requests a blocking send operation until the request is acknowledged.
406+
This flag is only supported for the :c:func:`nrf_send` and :c:func:`nrf_sendto` functions.
407+
When this flag is used, write operations on datagram sockets are blocked until the data has been sent on air, and write operations on stream sockets are blocked until data reception is acknowledged by the peer.
408+
The operation timeout can be configured using the :c:macro:`NRF_SO_SNDTIMEO` socket option.
409+
The valid timeout values are 1 to 600 seconds.
410+
For the :c:macro:`NRF_SOCK_STREAM` socket type , the operation is blocked until the data is acknowledged by the peer, and for the :c:macro:`NRF_SOCK_DGRAM` socket type, until the data is sent on-air by the modem.
411+
This flag is useful in scenarios where confirmation of receipt is critical.
412+
The default behavior is to return immediately after queuing the data for sending, without waiting for acknowledgment.
413+
This send flag cannot be used along with the :c:macro:`NRF_SO_SENDCB` socket option.

0 commit comments

Comments
 (0)