NN_SHUTDOWN(3compat)

πŸ“¦ version 1.11, in alpine 3.24

πŸ’… NN_SHUTDOWN(3compat) β€” the NNG Reference Manual, bestie edition πŸŽ€

okay so real talk, this is nn_shutdown from the NNG Reference Manual, and it's one of those legacy-compat girlies ✨ so let's get into it.


🌸 NAME 🌸

nn_shutdown β€” shut down endpoint (compatible API) 🫢


✨ SYNOPSIS ✨

#include <nanomsg/nn.h>

int nn_shutdown(int sock, int ep)

that's it, that's the whole vibe check. two ints in, one int out πŸ’…


πŸ’– DESCRIPTION πŸ’–

okay so nn_shutdown() literally shuts down the endpoint ep on the socket sock β€” and ep can be either a listener or a dialer, doesn't matter which, both are valid, slay 🌈

the way this works is it stops the socket from accepting new connections, or from establishing old ones (yes, "establishing old ones" β€” that's what it says, i don't make the rules). and on top of that? any established connections associated with ep get closed too. periodt. πŸ”₯

πŸ“Œ Note β€” this function is provided for API compatibility with legacy libnanomsg. consider using the relevant modern API instead. no cap, the modern API is the main character here πŸ‘‘ this one's just here for the nostalgia.

⭐ RETURN VALUES ⭐

  • returns zero on success πŸŽ‰
  • returns -1 on error 😭

like, zero is the good one, remember that, iykyk πŸ’€


πŸ™ˆ ERRORS πŸ™ˆ

  • EBADF β€” the socket sock is not open. bestie. you can't shut down a socket that isn't even open, come on 😭
  • EINVAL β€” an invalid ep was supplied. that endpoint did not pass the vibe check, so it's giving error 🚩

πŸ¦‹ SEE ALSO πŸ¦‹

go read those, they're iconic, i promise πŸ“šπŸ’œ


and that's the whole page, bestie! this one's from the NNG Reference Manual and it's dated 2026-01-13 β€” so yeah, fresh, current, timestamped and everything β°πŸ’– go forth and shut down those endpoints responsibly, mwah πŸ§šβ€β™€οΈπŸ’‹

πŸ“¦ where this page comes from