= nng_listener_id(3) // // Copyright 2018 Staysail Systems, Inc. // Copyright 2018 Capitar IT Group BV // // This document is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this // file was obtained (LICENSE.txt). A copy of the license may also be // found online at https://opensource.org/licenses/MIT. // == NAME nng_listener_id - return numeric listener identifier == SYNOPSIS [source, c] ---- #include int nng_listener_id(nng_listener l); ---- == DESCRIPTION The `nng_listener_id()` function returns a positive identifier for the listener _l_, if it is valid. Otherwise it returns `-1`. NOTE: A listener is considered valid if it was ever created with the xref:nng_listener_create.3.adoc[`nng_listener_create()`] or xref:nng_listen.3.adoc[`nng_listen()`] functions. listeners that are allocated on the stack or statically should be initialized with the macro xref:nng_ctx.5.adoc#NNG_LISTENER_INITIALIZER[`NNG_LISTENER_INITIALIZER`] to ensure that they cannot be confused with a valid listener before they are created properly. == RETURN VALUES This function returns the positive value for the listener identifier, or `-1` if the listener is invalid. == ERRORS None. == SEE ALSO [.text-left] xref:nng_listener.5.adoc[nng_listener(5)], xref:nng.7.adoc[nng(7)]