NN_CLOSE(3)
π NN_CLOSE β close an SP socket π
okay bestie, welcome to nn_close(3) from the nanomsg girlies (that's the manual page for nn_close, section 3, iykyk) π
β¨ NAME β¨
nn_close β close an SP socket π«Ά
β¨ SYNOPSIS β¨
#include <nanomsg/nn.h>
int nn_close (int s);
like. that's it. one int in, one int out. iconic honestly π
β¨ DESCRIPTION β¨
So nn_close closes the socket s. Periodt.
But wait, there's lore π§ β any buffered inbound messages that the application hasn't received yet? yeah, those get discarded. gone. not coming back. they're in the void now π
And for the outbound side: the library is gonna try its absolute best to deliver any outstanding outbound messages, and it'll do that for however long the NN_LINGER socket option tells it to. lowkey generous of it ngl.
πΈ heads up: while it's doing all that lingering, the call will block. so don't be surprised if your little nn_close hangs around for a bit. it's not being rude, it's just finishing its business β¨
β¨ RETURN VALUE β¨
- if the function succeeds β
0comes back, slay π - otherwise β
-1comes back anderrnogets set to one of the values listed down below π
β¨ ERRORS β¨
EBADFβ the socket you handed over is invalid. like, not a real socket. bestie. what is that πEINTRβ the operation got interrupted by a signal π and lowkey important: the socket is not fully closed yet. you can re-start the operation by callingnn_close()again π«Ά
β¨ EXAMPLE β¨
int s = nn_socket (AF_SP, NN_PUB);
assert (s >= 0);
int rc = nn_close (s);
assert (rc == 0);
make a socket, assert it's chill, close it, assert the close was chill. main character energy, no notes π
β¨ SEE ALSO β¨
nn_socket(3) nn_setsockopt(3) nanomsg(7)
go read those too, they're all part of the same friend group π
β¨ AUTHORS β¨
Martin Sustrik <sustrik@250bpm.com> β ty for your service king π«‘π
okay that's the whole page bestie, you're officially a nn_close expert, no cap. this was page NN_CLOSE(3) from nanomsg version 1.2.2, dated 2026-01-16 β mwah, go close some sockets responsibly π
β¨πΈ
π¦ 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