Provided by: libnng-dev_1.10.1-2_amd64 bug

NAME

       nng_listen - create and start listener

SYNOPSIS

           #include <nng/nng.h>

           int nng_listen(nng_socket s, const char *url, nng_listener *lp, int flags);

DESCRIPTION

       The nng_listen() function creates a newly initialized nng_listener object, associated with socket s, and
       configured to listen at the address specified by url, and starts it. If the value of lp is not NULL, then
       the newly created listener is stored at the address indicated by lp.

       Listeners are used to accept connections initiated by remote dialers. An incoming connection generally
       results in an nng_pipe object being created and attached to the socket s. Unlike dialers, listeners
       generally can create many pipes, which may be open concurrently.

       The flags argument is ignored, but reserved for future use.

           Tip

           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!

       Because the listener is started immediately, it is generally not possible to apply extra configuration;
       if that is needed applications should consider using nng_listener_create() and nng_listener_start()
       instead.

       The created listener will continue to accept new connections, associating their pipes with the socket,
       until either it or the socket s is closed.

RETURN VALUES

       This function returns 0 on success, and non-zero otherwise.

ERRORS

       NNG_EADDRINUSE
           The address specified by url is already in use.

       NNG_EADDRINVAL
           An invalid url was specified.

       NNG_ECLOSED
           The socket s is not open.

       NNG_EINVAL
           An invalid set of flags or an invalid url was specified.

       NNG_ENOMEM
           Insufficient memory is available.

SEE ALSO

       nng_dial(3), nng_listener_close(3), nng_listener_create(3) nng_listener_start(3), nng_strerror(3),
       nng_listener(5), nng(7)

                                                   2025-04-20                                      NNG_LISTEN(3)