nanomsg next generation NNG  
Home GitHub Documentation

This documentation is for version v1.2.2 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.
nn_connect(3compat)

SYNOPSIS

#include <nanomsg/nn.h>

int nn_connect(int sock, const char *url)

DESCRIPTION

The nn_connect() function arranges for the socket sock to initiate connection to a peer at the address specified by url. An “endpoint identifier” for this socket’s association with the url is returned to the caller on success. This ID can be used with nn_shutdown() to “unbind” the socket from the address at url.

This function is provided for API compatibility with legacy libnanomsg. Consider using the relevant modern API instead.
The connect operation is performed asynchronously, and may not have completed before this function returns control to the caller.
Only transports supported by legacy libnanomsg may be used with this function. In particular, only the schemes tcp://, ipc://, inproc://, and ws:// are supported with this function. (Use the modern API to use other schemes.)

RETURN VALUES

This function returns a positive identifier success, and -1 on error.

ERRORS

ECONNREFUSED

The connection attempt was refused.

EBADF

The socket sock is not open.

EINVAL

An invalid url was supplied.

NNG Reference Manual vv1.2.2 © 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.