NNG_RECVMSG(3)

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

πŸ’Œ NNG_RECVMSG(3) β€” it's giving receive a message

okay bestie, welcome to the NNG Reference Manual page for nng_recvmsg, and honestly? she's a baddie. let's get into it πŸ’–


✨ NAME ✨

nng_recvmsg β€” receive a message 🫢


✨ SYNOPSIS ✨

#include <nng/nng.h>

int nng_recvmsg(nng_socket s, nng_msg **msgp, int flags);

✨ DESCRIPTION ✨

So here's the tea: nng_recvmsg() receives a message on socket s, and it stores that received message at the location pointed to by msgp. that's it, that's the whole vibe πŸ’…

Tip 🌸 using this function gives you access to the message structure, so like… it may offer more functionality than the simpler nng_recv() function. lowkey iconic of her.

The flags may contain the following value:

  • NNG_FLAG_NONBLOCK β€” the function returns immediately, even if no message is available, bestie. without this flag? she will wait until a message is received by the socket s, or until any configured timer expires. no cap, she's patient like that ⏳
Note πŸ¦‹ the semantics of what receiving a message even means varies from protocol to protocol, so please, for the love of everything, go read the protocol documentation. it's encouraged!! (for example: with a req socket, a message may only be received after a request has been sent, and a sub socket may only receive messages corresponding to topics to which it has subscribed.) and also, some protocols may not support receiving data at all, such as pub. so yeah, vibe check your protocol first fr fr πŸ‘‘

✨ RETURN VALUES ✨

this function returns 0 on success, and non-zero otherwise. simple. clean. slay ✨


✨ ERRORS ✨

  • NNG_EAGAIN β€” the operation would block, but NNG_FLAG_NONBLOCK was specified. πŸ’€
  • NNG_ECLOSED β€” the socket s is not open.
  • NNG_EINVAL β€” an invalid set of flags was specified. πŸ™ˆ
  • NNG_ENOMEM β€” insufficient memory is available. 😭
  • NNG_ENOTSUP β€” the protocol for socket s does not support receiving.
  • NNG_ESTATE β€” the socket s cannot receive data in this state. it's not her moment, okay?!
  • NNG_ETIMEDOUT β€” the operation timed out. ⏰

✨ SEE ALSO ✨

nng_msg_free(3), nng_recv(3), nng_sendmsg(3), nng_strerror(3), nng_socket(5), nng(7)


and that's the whole page, bestie!! πŸŽ€ this was the NNG Reference Manual, dated 2026-06-30, and you absolutely ate reading all of it. go forth and nng_recvmsg() responsibly πŸ’œπŸ¦‹βœ¨ periodt.

πŸ“¦ where this page comes from