nanomsg next generation NNG  
Home GitHub Documentation

This documentation is for version v1.0.1 of nng, but the latest released version is v1.8.0. see the documentation for v1.8.0 for the most up-to-date information.
nng_listener_start(3)

SYNOPSIS

#include <nng/nng.h>

int nng_listener_start(nng_listener l, int flags);

DESCRIPTION

The nng_listener_start() function starts the listener l.

This causes the listener to bind to the address it was created with, and to start accepting connections from remote dialers. Each new connection results in an nng_pipe object, which will be attached to the listener’s socket.

Normally, the act of “binding” to it’s address is done synchronously, including any necessary name resolution. As a result, a failure, such as if the address is already in use, will be returned immediately. However, if the special value NNG_FLAG_NONBLOCK is supplied in flags, then this is done asynchronously; furthermore any failure to bind will be periodically reattempted in the background.

While NNG_FLAG_NONBLOCK can help an application be more resilient, it also generally makes diagnosing failures somewhat more difficult.

Once a listener has started, it is generally not possible to change it’s configuration.

RETURN VALUES

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

ERRORS

NNG_ECLOSED

Parameter l does not refer to an open listener.

NNG_ESTATE

The listener l is already started.

NNG Reference Manual vv1.0.1 © 2019 Staysail Systems, Inc, © 2018 Capitar IT Group BV
This document is supplied under the MIT License.
nanomsg™ and nng™ are trademarks of Garrett D'Amore.