From 03fabdf697d1fd19708d8c8a618c7ecb712ae64e Mon Sep 17 00:00:00 2001
From: gdamore The
+
+ 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. Sometimes it is necessary to integrate a socket into a nng_sub0_open_raw - SUB version 0, raw modenng_surveyor0_open_raw - SURVEYOR version 0, raw modeClosing a Socket
+
+int nng_socket_close(nng_socket s);
+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.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);
poll or select driven
-event loop. (Or, on Linux, epoll, or on BSD derived systems like macOS kqueue).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
It is now required for applications to initialize the library explicitly before using it.
This is done using the nng_init function.
The nng_close function has been renamed to nng_socket_close to make it clearer that
+the object being closed is a socket.
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_strerrornn_errnoerrno.nn_socketnng_req0_open.nn_closenng_closenn_closenng_socket_closenn_bindnng_listen, nng_listener_createnng_lister_create and configuring it offers more capabilities.nn_connectnng_dial, nng_dialer_createnng_dialer_create and configuring it offers more capabilities.nn_shutdownnng_lister_close, nng_dialer_closegetopt, 1nng_respondent0_open_raw, 1nng_sleep_aio, 1nng_socket, 1nng_socket_get_recv_poll_fd, 1nng_socket_get_send_poll_fd, 1nng_socket_close, 1nng_socket_get_recv_poll_fd, 1nng_socket_get_send_poll_fd, 1nng_socket_id, 1nng_socket_peer_id, 1nng_socket_peer_name, 1