NN_DEVICE(3compat)
hey bestie π this is the NN_DEVICE(3compat) page from the NNG Reference Manual, and itβs giving legacy-compat realness. letβs get into it π«Ά
πΈ NAME πΈ
nn_device β create forwarding device (compatible API) π οΈ
β¨ SYNOPSIS β¨
#include <nanomsg/nn.h>
int nn_device(int sock1, int sock2);
π DESCRIPTION π
okay so nn_device() is used to create a forwarder. messages received on one of the two sockets, sock1 and sock2, are forwarded to the other one. itβs giving matchmaker energy, but for messages π
Note π this function is provided for API compatibility with legacy libnanomsg. consider using the relevant modern API instead. lowkey a βfor the archivesβ situation, bestie.
the two sockets must be compatible, and must be raw mode sockets. more detail about devices and how they can be used is available in the new style nng_device() documentation. go off, modern docs π
π¦ RETURN VALUES π¦
this function blocks forever, fr fr. it will return -1 only when one of the sockets is closed or an error occurs. so donβt wait up for a cute little 0 ππ
π ERRORS π
EBADFβ one of the two sockets is invalid or not open, or has (and yes, the original line stops right there β no cap, thatβs the whole vibe π« )EINVALβ the sockets are not compatible with each other, or not both raw.ENOMEMβ insufficient memory is available.
π SEE ALSO π
okay thatβs the whole page, bestie. source/version: NNG Reference Manual; date: 2026-01-13. mwah πβ¨
π¦ where this page comes from
- alpine 3.24: nng-doc 1.11-r0 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms