Skip to content

Latest commit

 

History

History
78 lines (58 loc) · 2.17 KB

nn_socket.3compat.adoc

File metadata and controls

78 lines (58 loc) · 2.17 KB

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

Normal socket.

AF_SP_RAW

“Raw mode” socket.

The protocol indicates the protocol to be used when creating the socket. The following protocols are defined:

NN_PAIR

Pair protocol.

NN_PUB

Publisher protocol.

NN_SUB

Subscriber protocol.

NN_REQ

Requestor protocol.

NN_REP

Replier protocol.

NN_PUSH

Push protocol.

NN_PULL

Pull protocol.

NN_SURVEYOR

Surveyor protocol.

NN_RESPONDENT

Respondent protocol.

NN_BUS

Bus protocol.

RETURN VALUES

This function returns a valid socket number on success, and -1 on failure.

ERRORS

ENOMEM

Insufficient memory is available.

ENOTSUP

The protocol is not supported.

ETERM

The library is shutting down.