nanomsg next generation NNG  
Home GitHub Documentation

This documentation is for version 0.5.0 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_dialer_create(3)

SYNOPSIS

#include <nng/nng.h>

int nng_dialer_create(nng_dialer *dialerp, nng_socket s, const char *url);

DESCRIPTION

The nng_dialer_create() function creates a newly initialized dialer, associated with socket s, and configured to connect to the address specified by url, and stores a pointer to at the location referenced by dialerp.

Dialers initiate a remote connection to a listener. Upon a successful connection being established, they create a pipe, add it to the socket, and then wait for that pipe to be closed. When the pipe is closed, they will re-initiate the connection. Dialer’s will also periodically retry a connection automatically if an attempt to connect asynchronously fails.

While it is convenient to think of dialers as "clients", 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 dialer is not started, but may be further configured with the nng_dialer_setopt(3) family of functions.

Once it is fully configured, the dialer may be started using the nng_dialer_start(3) function.

If no specific configuration is required, consider using the simpler nng_dial(3) function instead.

RETURN VALUES

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

ERRORS

NNG_EADDRINVAL

An invalid url was specified.

NNG_ECLOSED

The socket s is not open.

NNG_ENOMEM

Insufficient memory is available.

NNG Reference Manual v0.5.0 © 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.