nn_socket(3compat)
| NN_SOCKET(3compat) | NNG Reference Manual | NN_SOCKET(3compat) |
NAME
nn_socket - create socket (compatible API)
SYNOPSIS
#include <nanomsg/nn.h> int nn_socket(int af, int proto);
DESCRIPTION
The nn_socket() function creates socket using the address family af and protocol proto and returns it.
Note
This function is provided for API
compatibility with legacy libnanomsg. Consider using the relevant
modern API instead.
Important
Mixing the compatibility API and the modern API is not supported
on a given socket.
Note
Some protocols, transports, and features are only available in the modern API.
The address family af can be one of two values:
AF_SP
AF_SP_RAW
The protocol indicates the protocol to be used when creating the socket. The following protocols are defined:
NN_PAIR
NN_PUB
NN_SUB
NN_REQ
NN_REP
NN_PUSH
NN_PULL
NN_SURVEYOR
NN_RESPONDENT
NN_BUS
RETURN VALUES
This function returns a valid socket number on success, and -1 on failure.
ERRORS
ENOMEM
ENOTSUP
ETERM
SEE ALSO
nng_socket(5), nn_close(3compat), nn_errno(3compat), nng_compat(3compat), nng(7)
| 2026-05-29 |
