From 03fabdf697d1fd19708d8c8a618c7ecb712ae64e Mon Sep 17 00:00:00 2001 From: gdamore Date: Tue, 31 Dec 2024 21:44:58 +0000 Subject: deploy: b0874b1dad787c32093a3ff81311e2d638dc6538 --- ref/print.html | 48 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 7 deletions(-) (limited to 'ref/print.html') diff --git a/ref/print.html b/ref/print.html index 4a48cc91..26521b24 100644 --- a/ref/print.html +++ b/ref/print.html @@ -1210,17 +1210,47 @@ To obtain asynchronous behavior, consider using context
  • nng_sub0_open_raw - SUB version 0, raw mode
  • nng_surveyor0_open_raw - SURVEYOR version 0, raw mode
  • +

    Closing a Socket

    +
    int nng_socket_close(nng_socket s);
    +
    +

    The nng_socket_close function closes a socket, releasing all resources +associated with it. Any operations that are in progress will be terminated with +a result of NNG_ECLOSED.

    +
    +

    + + note +

    +

    Closing a socket also invalidates any dialers, listeners, +pipes, or contexts associated with it.

    +
    +
    +

    + + note +

    +

    This function will wait for any outstanding operations to be aborted, or to complete, +before returning. Consequently it is not safe to call this from contexts that cannot +block.

    +
    +
    +

    + + note +

    +

    Closing the socket may be disruptive to transfers that are still in progress.

    +

    Polling Socket Events

    int nng_socket_get_recv_poll_fd(nng_socket s, int *fdp);
     int nng_socket_get_send_poll_fd(nng_socket s, int *fdp);
     

    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, @@ -5851,6 +5881,9 @@ See the Migrating From libnanomsg chapter for

    Library Initialization

    It is now required for applications to initialize the library explicitly before using it. This is done using the nng_init function.

    +

    Socket Close Function Renamed

    +

    The nng_close function has been renamed to nng_socket_close to make it clearer that +the object being closed is a socket.

    New AIO Error Code NNG_ESTOPPED

    When an operation fails with NNG_ESTOPPED, it means that the associated [nni_aio] object has been permanently stopped and must not be reused. Applications must watch for this error code, and @@ -6166,7 +6199,7 @@ NNG approach to messages. Likewise there is no struct nn_cmsghdr eq nn_strerrornng_strerror nn_errnoNoneErrors are returned directly rather than through errno. nn_socketVariousUse the appropriate protocol constructor, such as nng_req0_open. -nn_closenng_close +nn_closenng_socket_close nn_bindnng_listen, nng_listener_createAllocating a listener with nng_lister_create and configuring it offers more capabilities. nn_connectnng_dial, nng_dialer_createAllocating a dialer with nng_dialer_create and configuring it offers more capabilities. nn_shutdownnng_lister_close, nng_dialer_close @@ -6279,7 +6312,7 @@ condition variable, 1
    CPU-bound, 1
    duration, 1
    error message, 1
    -event loop, 1
    +event loop, 1
    flow control, 1
    gather, 1
    getopt, 1
    @@ -6417,8 +6450,9 @@ named pipes, 1
    nng_respondent0_open_raw, 1
    nng_sleep_aio, 1
    nng_socket, 1
    -nng_socket_get_recv_poll_fd, 1
    -nng_socket_get_send_poll_fd, 1
    +nng_socket_close, 1
    +nng_socket_get_recv_poll_fd, 1
    +nng_socket_get_send_poll_fd, 1
    nng_socket_id, 1
    nng_socket_peer_id, 1
    nng_socket_peer_name, 1
    -- cgit v1.2.3-70-g09d2