nn_connect(3compat)
| NN_CONNECT(3compat) | NNG Reference Manual | NN_CONNECT(3compat) |
NAME
nn_connect - connect to remote peer (compatible API)
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 identifier for this socket’s association with the url is returned to the caller on success. This identifier can be used with nn_shutdown() to remove the association later.
Note
This function is provided for API
compatibility with legacy libnanomsg. Consider using the relevant
modern API instead.
Note
The connect operation is performed asynchronously, and may not
have
completed before this function returns control to the caller.
Important
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
EBADF
EINVAL
SEE ALSO
nn_bind(3compat), nn_errno(3compat), nn_shutdown(3compat), nn_socket(3compat), nn_compat(3compat), nng(7)
| 2026-06-29 |
