NNG_DIALER(5)

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

πŸ’– NAME πŸ’–

nng_dialer β€” bestie it's literally the dialer, the outgoing-connection icon herself ✨


πŸŽ€ SYNOPSIS πŸŽ€

#include <nng/nng.h>

typedef struct nng_dialer_s nng_dialer;

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so an nng_dialer is a handle to a dialer object, and her whole job β€” her entire main character moment β€” is creating a single nng_pipe at a time by establishing an outgoing connection. One at a time. She's methodical like that. πŸ’…

And if that connection breaks, or fails entirely? She does not give up. The dialer object will automatically attempt to reconnect, and will keep doing so until the dialer or the socket is destroyed. Persistence queen behavior fr fr. πŸ”₯

Dialer objects get created by the nng_dialer_create() or nng_dial() functions, and they're always associated with a single nng_socket. Like, always always. No polyamory with sockets here, she's loyal. 🫢

⚠️ Important β€” the nng_dialer structure is always passed by value, both for input parameters and return values, and you should treat it opaquely (no peeking inside, bestie, it's giving mystery ✨). Passing structures this way gives the compiler a chance to perform accurate type checks in functions passing values of this type. So like, respect the privacy and the compiler will have your back.
πŸ’‘ Tip β€” a given nng_socket may have multiple dialer objects, multiple listener objects, or even some of both. She contains multitudes, honestly.
πŸ’‘ Tip β€” the client/server relationship described by dialer/listener is completely orthogonal to any similar relationship in the protocols. For example, a rep socket may use a dialer to connect to a listener on an req socket. And the way that this orthogonality can lead to innovative solutions to otherwise challenging communications problems?? Chef's kiss. πŸ˜­πŸ‘‘

Dialer objects may be destroyed by the nng_dialer_close() function. They are also closed when their associated socket is closed β€” when one goes, they all go, ride or die. πŸ’€


🌸 Initialization 🌸

A dialer may be initialized using the macro NNG_DIALER_INITIALIZER before it is opened, to prevent confusion with valid open dialers. Basically: mark her as "not open yet" so nobody gets her confused with a dialer who's actually out there living her life. 🌈


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole vibe, bestie πŸŽ€ go forth and dial responsibly βœ¨πŸ¦‹

NNG Reference Manual β€” page NNG_DIALER(5), dated 2026-06-30 πŸ’– she's iconic, she's periodt, she's canon πŸ‘‘

πŸ“¦ where this page comes from