NN_PAIR(7)
π NN_PAIR(7) π
okay bestie, welcome to the nanomsg manpage for nn_pair β the one-to-one scalability protocol. yes it's giving "group project where the group is literally two people" energy and honestly? that's the whole vibe. let's get into it π«Ά
β¨ SYNOPSIS β¨
like all the nanomsg girlies, you start here:
#include <nanomsg/nn.h>
#include <nanomsg/pair.h>
πΈ DESCRIPTION πΈ
okay so. Pair protocol is the simplest and least scalable scalability protocol. not "simplest" as in "cute and easy", more like "simplest" as in "there is nothing else going on here". it lets you scale by breaking your application into exactly two pieces. exactly. two. no more, no less. π
for example β picture a monolithic application that handles both the accounting and the agenda of an HR department. iconic? maybe. scalable? no. so you split it into two applications (accounting vs. HR) and run them on two separate servers. those two apps can then talk to each other via PAIR sockets. slay, it works, two servers are now doing the thing. β¨
but here's the tea, and it's a little bitter: the downside of this protocol is that its scaling properties are very limited. splitting the application into two pieces only ever lets you scale those two servers. to add a third server to the cluster, the application has to be split once more β say by separating the HR functionality into a hiring module and a salary computation module. it's giving "you must construct additional pylons" except the pylons are refactors. π
so whenever possible, try to use one of the more scalable protocols instead. fr fr. this one is a starter pack, not a forever home. π
π¦ Socket Types π¦
NN_PAIRβ Socket for communication with exactly one peer. Each party can send messages at any time. If the peer is not available, or the send buffer is full, subsequent calls tonn_send(3)will block until it's possible to send the message. no cap, it will just sit there and wait. patiently. main character patience. β
π Socket Options π
No protocol-specific socket options are defined at the moment.
(yes that's it. nothing. the void. we love a low-maintenance protocol π«Ά)
π SEE ALSO π
go read these next bestie, they're the more scalable ones i was talking about:
π AUTHORS π
Martin Sustrik <sustrik@250bpm.com>
this has been NN_PAIR(7) from nanomsg 1.2.2, brought to you on 2026-01-16. that's the version, that's the date, and that's the whole page. go forth and pair (with exactly one peer, obviously). πβ¨
π¦ where this page comes from
- fedora 44: nanomsg-devel 1.2.2-2.fc44 Β· MIT
- fedora 44: nanomsg-devel 1.2.2-2.fc44 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms