GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
NN_DEVICE(3) nanomsg 1.1.5 NN_DEVICE(3)

nn_device - start a device

#include <nanomsg/nn.h>

int nn_device (int s1, int s2);

Starts a device to forward messages between two sockets. If both sockets are valid, nn_device function loops and sends any messages received from s1 to s2 and vice versa. If only one socket is valid and the other is negative, nn_device works in a "loopback" mode — it loops and sends any messages received from the socket back to itself.

To break the loop and make nn_device function exit use the nn_term(3) function.

The function loops until it hits an error. In such a case it returns -1 and sets errno to one of the values defined below.

EBADF
One of the provided sockets is invalid.

EINVAL

Either one of the socket is not an AF_SP_RAW socket; or the two sockets don’t belong to the same protocol; or the directionality of the sockets doesn’t fit (e.g. attempt to join two SINK sockets to form a device).

EINTR

The operation was interrupted by delivery of a signal.

ETERM

The library is terminating.

int s1 = nn_socket (AF_SP_RAW, NN_REQ);
nn_bind (s1, "tcp://127.0.0.1:5555");
int s2 = nn_socket (AF_SP_RAW, NN_REP);
nn_bind (s2, "tcp://127.0.0.1:5556");
nn_device (s1, s2);

nn_socket(3) nn_term(3) nanomsg(7)

Martin Sustrik <sustrik@250bpm.com>
2018-10-15  

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.