NNG_STREAM_DIALER_ALLOC(3str)

πŸ“¦ version 1.11, in alpine 3.24

✨ NNG_STREAM_DIALER_ALLOC(3str) ✨

okay so this is from the NNG Reference Manual bestie, page NNG_STREAM_DIALER_ALLOC(3str) β€” and it's literally all about making a dialer for byte streams πŸŽ€


🌸 NAME 🌸

nng_stream_dialer_alloc β€” allocate a byte stream dialer πŸ¦‹


πŸ’… SYNOPSIS πŸ’…

#include <nng/nng.h>

int nng_stream_dialer_alloc(nng_stream_dialer **dp, const char *addr);

int nng_stream_dialer_alloc_url(nng_stream_dialer **dp, const nng_url *url);

✨ DESCRIPTION ✨

So these functions allocate a dialer for byte streams, no cap. And a dialer's whole thing β€” its whole main character energy β€” is making nng_stream objects by initiating outgoing connections, via the nng_stream_dialer_dial() function. 🫢

The first form, nng_stream_dialer_alloc(), connects to the address specified by addr, which should be a string representing a URL. simple as that πŸ’–

The second form, nng_stream_dialer_alloc_url(), takes a pre-parsed or pre-constructed nng_url object to determine the remote address. like, you already did the parsing, slay πŸ‘‘

These functions may support different URL schemes, such as ipc://, tcp://, tls+tcp://, or ws://. lowkey iconic that they're flexible like that 🌈

Both forms store the dialer in the location referenced by dp. don't forget your pointer-to-pointer, bestie πŸ’€


🌟 RETURN VALUES 🌟

These functions return 0 on success, and non-zero otherwise. that's the vibe check β€” zero is good, anything else means something went sideways 😭


πŸ™ˆ ERRORS πŸ™ˆ

  • NNG_ENOMEM β€” Insufficient free memory exists. your machine said "I have nothing left to give" fr fr πŸ’€
  • NNG_ENOTSUP β€” The URL scheme is not supported by the implementation. this implementation looked at your scheme and was like, not today 🚫
  • NNG_EADDRINVAL β€” The URL requested is invalid. the address you handed over did not pass inspection, ngl πŸ™ˆ

πŸ¦‹ SEE ALSO πŸ¦‹

go read those next, iykyk πŸ“šβœ¨


okay that's the whole page, bestie β€” mwah πŸ’‹ this one dropped 2026-01-13 from the NNG Reference Manual and it's filed under NNG_STREAM_DIALER_ALLOC(3str). go forth and dial responsibly πŸŽ€πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from