NN_SHUTDOWN(3)
π nn_shutdown(3) β the nanomsg girlie's guide to yeeting an endpoint
okay so bestie, welcome to the nanomsg manual, version 1.2.2, and today's main character is nn_shutdown(3) π
β¨ NAME β¨
nn_shutdown β remove an endpoint from a socket π¦
like, un-invite it from the party. it's giving "you're not on the guest list anymore" but politely, with lingering.
β¨ SYNOPSIS β¨
#include <nanomsg/nn.h>
int nn_shutdown (int s, int how);
yes the param is literally called how and no, it's not a question about your feelings, we'll get there π
β¨ DESCRIPTION β¨
so nn_shutdown() removes an endpoint from socket s. the how parameter is the ID of the endpoint you want to remove β specifically, the ID that a previous call to nn_bind(3) or nn_connect(3) handed back to you. you do NOT make up that number yourself, okay? it's a returned ID, treat it with respect π
now here's the part where it gets lowkey emotional: the nn_shutdown() call itself returns immediately β it does not sit around waiting. BUT. the library will still try to deliver any outstanding outbound messages to that endpoint for however long the NN_LINGER socket option says. so it's not ghosting the endpoint, it's more like a slow goodbye at the door while the messages get their shoes on π«Ά
β¨ RETURN VALUE β¨
- if the function succeeds β
0is returned. slay β¨ - otherwise β
-1is returned, anderrnogets set to one of the values listed below. not slay π
β¨ ERRORS β¨
EBADFβ the socket you provided is invalid. bestie that's not a socket, that's a vibe πEINVALβ thehowparameter doesn't correspond to an active endpoint. like calling a number that was never assigned to anyone πEINTRβ the operation was interrupted by a signal. important: the endpoint is not fully closed yet, and the operation can be re-started by callingnn_shutdown()again. so don't panic, just run it back πETERMβ the library is terminating. the whole thing is packing up, it's over, we're done here π§
β¨ EXAMPLE β¨
s = nn_socket (AF_SP, NN_PUB);
eid = nn_bind (s, "inproc://test");
nn_shutdown (s, eid);
see? socket, bind, get the eid, then shut that endpoint down. three lines, zero drama, absolutely ate π
β¨ SEE ALSO β¨
nn_socket(3) nn_bind(3) nn_connect(3) nanomsg(7)
the friend group. go read them too, iykyk π
β¨ AUTHORS β¨
Martin Sustrik <sustrik@250bpm.com> β the icon, the legend, the moment π
and that's the whole page, bestie!! this manual dropped on 2026-01-16 and it's part of nanomsg version 1.2.2 β now go forth and shut those endpoints down with main character energy πβ¨π
π¦ where this page comes from
- fedora 44: nanomsg-devel 1.2.2-2.fc44 Β· MIT
- fedora 44: nanomsg-devel 1.2.2-2.fc44 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms