--- version: tip layout: refman --- nng_tcp_dialer_dial(3tcp)

SYNOPSIS

#include <nng/nng.h>
#include <nng/supplemental/tcp/tcp.h>

void nng_tcp_dialer_dial(nng_tcp_dialer *d, const nng_sockaddr *sa, nng_aio *aio);

DESCRIPTION

The nng_tcp_dialer_dial() attempts to establish a TCP connection to the remote peer identified by sa, using the dialer d. The operation is completed asynchronously, using aio.

The address sa must be in the NNG_AF_INET or NNG_AF_INET6 families, and have a valid IPv4 or IPv6 address and TCP port number.

If a connection is successfully established, the aio will have the resulting nng_tcp stored as its first output. (See nng_aio_get_output().)

RETURN VALUES

None.

ERRORS

NNG_EADDRINVAL

The address specified is invalid.

NNG_ECANCELED

The operation was aborted.

NNG_ECLOSED

The dialer is closed.

NNG_ECONNREFUSED

The TCP connection was refused by the server.

NNG_ECONNRESET

The TCP connection was reset by the server.

NNG_ENOMEM

Insufficient free memory exists.

SEE ALSO