NNG_SUB_OPEN(3)

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

✨ NNG_SUB_OPEN(3) ✨

okay bestie, welcome to the NNG Reference Manual πŸ’– this is the page for nng_sub_open and it's literally your backstage pass to making a brand new sub socket. pull up a chair, we're doing this together 🫢


🌸 NAME 🌸

nng_sub_open β€” create sub socket ✨


πŸŽ€ SYNOPSIS πŸŽ€

#include <nng/nng.h>
#include <nng/protocol/pubsub0/sub.h>

int nng_sub0_open(nng_socket *s);

int nng_sub0_open_raw(nng_socket *s);

πŸ’… DESCRIPTION πŸ’…

so like, there's two functions here and they're sisters, not twins, okay?

  • nng_sub0_open() β€” this one makes a sub version 0 socket and hands it back to you at the location that s is pointing at. that's it, that's the whole job πŸ’–
  • nng_sub0_open_raw() β€” same energy, BUT it makes a sub version 0 socket in raw mode and returns it at the spot s points to. raw mode is the unhinged one, iykyk πŸ”₯
ngl, the "at the location pointed to by s" part matters β€” you're passing a pointer, she's writing the socket into it. no cap. πŸ’…

🌈 RETURN VALUES 🌈

  • returns 0 when it ate and left no crumbs βœ…
  • returns non-zero otherwise (aka when it did NOT work, sorry bestie 😭)

πŸ’€ ERRORS πŸ’€

here's the vibe check on what can go wrong:

  • NNG_ENOMEM β€” insufficient memory is available 🧠πŸ’₯ girl is out of RAM, that's it, that's the problem.
  • NNG_ENOTSUP β€” the protocol is not supported πŸ™ˆ like... it's just not in the building.

πŸ‘‘ SEE ALSO πŸ‘‘

go read these next, they're iconic:


okay that's the whole page babe, you're officially a sub socket girly now πŸ¦‹ this was the NNG Reference Manual, dated 2026-06-30, and honestly? she ate. periodt πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from