NNG_REP(7)
π NNG_REP(7) β the nng_rep reply protocol, bestie edition π
okay so this is the nng_rep page from the NNG Reference Manual, and it's about the reply protocol π. grab a snack, we're doing this.
β¨ SYNOPSIS β¨
#include <nng/protocol/reqrep0/rep.h>
πΈ DESCRIPTION πΈ
So the rep protocol is literally one half of a request/reply pattern π«Ά. In this pattern, a requester sends a message to one replier, who is expected to reply back. and if no reply shows up? the request gets resent π€ β it keeps trying until a reply arrives or the request times out. no abandoning ship, no ghosting.
Tip π‘
This protocol is useful for setting up RPC-like services, fr fr. It's also reliable, in that a requester will keep retrying until a reply is received. it does not give up on you π .
So just to be crystal clear: rep is the replier side, and req is the requester side. two halves of one iconic duo π.
π¦ Socket Operations π¦
The nng_rep0_open() functions create a replier socket. this socket may be used to receive messages (requests), and then to send replies. it's giving customer service energy honestly.
Generally, a reply can only be sent after receiving a request. that's the whole vibe.
Send operations will result in NNG_ESTATE if no corresponding request was previously received π. like... you can't reply to nothing bestie.
Likewise, only one receive operation may be pending at a time. Any additional concurrent receive operations will result in NNG_ESTATE π. one at a time, we are not multitasking here.
Raw mode sockets ignore all these restrictions. chaos mode: enabled β¨.
π Context Operations π
This protocol supports the creation of contexts for concurrent use cases using nng_ctx_open() π.
Each context may have at most one outstanding request, and operates independently of the others. The restrictions for order of operations with sockets apply equally well for contexts, except that each context will be treated as if it were a separate socket π. so like, each context is its own lil main character.
β Protocol Versions β
Only version 0 of this protocol is supported. (At the time of writing, no other versions of this protocol have been defined.) so yeah, v0 or nothing, bestie π.
π Protocol Options π
The rep protocol has no protocol-specific options. nothing. zero. the minimalism is iconic honestly.
π§ Protocol Headers π§
The rep protocol uses a backtrace in the header π¦. This is more fully documented in the req manual β go read that one for the full tea.
π₯ SEE ALSO π₯
and that's the whole page, periodt πβ¨ this was NNG_REP(7) from the NNG Reference Manual, dated 2026-06-30. slay, go build something with it ππ«Άπ
π¦ where this page comes from
- ubuntu stonking: libnng-dev 1.12.0-1 Β· MIT OR Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms