NNG_BUS(7)

πŸ“¦
version 1.12.0 Β· 4 versions
, in ubuntu stonking

✨ nng_bus β€” the bus protocol, aka the group-chat of sockets ✨

okay bestie, gather round, because nng_bus (from the NNG Reference Manual, no less) is literally the mesh-networking protocol and she is everything πŸ’–


🌈 SYNOPSIS

#include <nng/protocol/bus0/bus.h>

that's it, that's the include, she's lowkey minimal πŸŽ€


πŸ’… DESCRIPTION

So the bus protocol is how you build mesh networks where every peer is connected to every other peer β€” like a group chat where everyone has everyone else's number, no cap. In this protocol, every single message a node sends gets sent out to every one of its directly connected peers. iconic behavior, truly. πŸ‘‘

Tip πŸ’‘ Messages are only sent to directly connected peers. Which means if a peer is only connected indirectly, bestie, she will NOT receive your messages. So when you're building a mesh network with this protocol, it is therefore important that a fully-connected mesh network be constructed. no shortcuts, fr fr.

All message delivery in this pattern is best-effort, which means peers may simply not receive messages. And like, delivery may occur to some, all, or none of the directly connected peers. (Messages are not delivered when peer nodes are unable to receive.) So here's the slay: send operations will never block β€” instead, if the message can't be delivered for any reason, it just gets discarded. gone. deleted. πŸ’€

Tip ✨ In order to minimize the likelihood of message loss, this protocol should not be used for high throughput communications. Furthermore, the more traffic in aggregate that occurs across the topology, the more likely that message loss is to occur. it's giving "the vibe gets messy when everyone's talking at once" 😭

πŸ¦‹ Socket Operations

The nng_bus0_open() functions create a bus socket. This socket may be used to send and receive messages. Sending messages will attempt to deliver to each directly connected peer β€” she's doing her best, okay?? 🫢


🌸 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 version 0 is the main character, periodt. πŸ’…


πŸŽ€ Protocol Options

The bus protocol has no protocol-specific options. that's right, zero, zilch, nothing to configure, we love a low-maintenance queen. ⭐


πŸ’œ Protocol Headers

When using a bus socket in raw mode, received messages will contain the incoming pipe ID as the sole element in the header. πŸ‘€

If a message containing such a header is sent using a raw bus socket, then the message will be delivered to all connected pipes except the one identified in the header. This behavior is intended for use with device configurations consisting of just a single socket. Such configurations are useful in the creation of rebroadcasters, and this capability prevents a message from being routed back to its source. (we do NOT do circular drama here, bestie πŸ™ˆ)

If no header is present, then a message is sent to all connected pipes.

When using normal (cooked mode) bus sockets, no message headers are present. clean, simple, chef's kiss. ✨


πŸ‘‘ SEE ALSO


that's the whole page, bestie!! go forth and mesh responsibly πŸŒˆπŸ¦‹πŸŒΈ

NNG Reference Manual Β· dated 2026-06-30 Β· NNG_BUS(7) β€” sending u all the love, no packet loss πŸ’–
πŸ“¦ where this page comes from