-
Encountered some issues when introducing nng, and would appreciate some help. Thank you very much. A large number of ordinary sockets and libev are currently used in the original system. Now we want to gradually introduce nng, so it is necessary for the two to work together. There are several points that need attention:
The solution found is to obtain the fd of the nng socket and manage it with libev. However, since nng does not use sockets for inter-process or inter-thread communication, it is not possible to obtain the fd. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
NNG specifically has support for this. See the NNG_OPT_SENDFD, and NNG_OPT_RECVFD options that you can use with a socket. These will poll ready (poll for read) when the socket can either send or receive. Note that these file descriptors are only for signaling and should not be accessed directly except for epoll() or poll() or select() signaling. See https://nng.nanomsg.org/man/v1.2.2/nng_options.5.html#NNG_OPT_SENDFD and https://nng.nanomsg.org/man/v1.2.2/nng_options.5.html#NNG_OPT_RECVFD |
Beta Was this translation helpful? Give feedback.
NNG specifically has support for this.
See the NNG_OPT_SENDFD, and NNG_OPT_RECVFD options that you can use with a socket.
These will poll ready (poll for read) when the socket can either send or receive. Note that these file descriptors are only for signaling and should not be accessed directly except for epoll() or poll() or select() signaling.
See https://nng.nanomsg.org/man/v1.2.2/nng_options.5.html#NNG_OPT_SENDFD and https://nng.nanomsg.org/man/v1.2.2/nng_options.5.html#NNG_OPT_RECVFD