Skip to content

Commit

Permalink
nrf_modem: doc: add info about PDN down when NRF_SO_KEEPOPEN is used
Browse files Browse the repository at this point in the history
Add info about PDN down events when NRF_SO_KEEPOPEN is used.

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
  • Loading branch information
eivindj-nordic authored and anangl committed Jun 24, 2024
1 parent 490cea2 commit 37e2ac2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion nrf_modem/doc/sockets/pdn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,18 @@ Handling PDN errors on sockets
******************************

During operation, an active PDN connection may be deactivated due to loss of connectivity or other reasons.

The following applies to sockets that have set the :c:macro:`NRF_SO_KEEPOPEN` socket option:

The loss of an active PDN connection will not result in errors.
Socket operations can return errors due to lack of PDN connectivity.
Upon PDN reactivation, the socket is functional and can resume its operations.
The application is responsible for detecting and re-attempting operations that fail while the socket does not have an active PDN.

The following applies to sockets that have not set the :c:macro:`NRF_SO_KEEPOPEN` socket option:

When a socket operation is attempted on a socket that no longer has an active PDN connection, the operation will return ``-1`` and set ``errno`` to ``NRF_ENETDOWN``.
If the socket is being polled, the :c:func:`nrf_poll` function will set the ``POLLERR`` flag and set the socket error to ``NRF_ENETDOWN``.
The socket error can be retrieved using the :c:macro:`NRF_SO_ERROR` socket option.

When the ``NRF_ENETDOWN`` error is detected, the socket is no longer usable and must be closed by the application.
The application is responsible for detecting when the PDN connection is activated again, before re-creating the socket and attempting the failed operation again.

0 comments on commit 37e2ac2

Please sign in to comment.