#include <nng/nng.h> int nng_listener_create(nng_listener *listenerp, nng_socket s, const char *url);
nng_listener_create() function creates a newly initialized
nng_listener object, associated with socket s,
and configured to listen at the address specified by url,
and stores a pointer to at the location referenced by listenerp.
Listeners are used to accept connections initiated by remote dialers. An incoming connection generally results in a pipe being created and attached to the socket s. Unlike dialers, listeners generally can create many pipes, which may be open concurrently.
|While it is convenient to think of listeners as “servers”, the relationship between the listener or dialer is orthogonal to any server or client status that might be associated with a given protocol. For example, a req socket might have associated dialers, but might also have associated listeners. It may even have some of each at the same time!|
The listener is not started, but may be further configured with
nng_listener_setopt() family of
Once it is fully configured, the listener may be started using the
If no specific configuration is required, consider using the
This function returns 0 on success, and non-zero otherwise.
An invalid url was specified.
The socket s is not open.
Insufficient memory is available.