NN_BIND(3compat)

πŸ“¦ version 1.11, in alpine 3.24

okay so this is NN_BIND(3compat) from the NNG Reference Manual, and bestie, it’s giving β€œlegacy API with main character energy” πŸ’…βœ¨

πŸ’– NAME πŸ’–

nn_bind β€” accept connections from remote peers (compatible API)

🌸 SYNOPSIS 🌸

#include <nanomsg/nn.h>

int nn_bind(int sock, const char *url)

πŸ¦‹ DESCRIPTION πŸ¦‹

The nn_bind() function arranges for the socket sock to accept connections at the address specified by url. An identifier for this socket’s association with the url is returned to the caller on success. This identifier can be used with nn_shutdown() to remove the association later. no cap, that’s the whole vibe 🫢

πŸ“ Note

This function is provided for API compatibility with legacy libnanomsg. Consider using the relevant modern API instead.

πŸ“ Note

The bind operation is performed asynchronously, and may not have completed before this function returns control to the caller. so like, don’t assume it’s already done the second you get control back, bestie 😭

⚠️ Important

Only transports supported by legacy libnanomsg may be used with this function. In particular, only the schemes tcp://, ipc://, inproc://, and ws:// are supported with this function. (Use the modern API to use other schemes.) this part is lowkey crucial πŸ”₯

πŸŽ€ RETURN VALUES πŸŽ€

This function returns a positive identifier on success, and -1 on error. periodt πŸ’…

πŸ’œ ERRORS πŸ’œ

  • EADDRINUSE β€” The address specified by url is already in use. somebody else got there first, bestie πŸ’€
  • EADDRNOTAVAIL β€” The address specified by url is not available.
  • EBADF β€” The socket sock is not open.
  • EINVAL β€” An invalid url was supplied.

🌈 SEE ALSO 🌈

go peek at these, iykyk:


that’s the whole page, bestie β€” brought to you by the NNG Reference Manual, dated 2026-01-13, and starring NN_BIND(3compat). stay slay and bind responsibly πŸ’–βœ¨

πŸ“¦ where this page comes from