NN_GET_STATISTIC(3)
π NN_GET_STATISTIC(3) π
okay bestie, welcome to nanomsg 1.2.2 β lemme tell you about the little function that lets you peek at your socket's ~numbers~ π
β¨ NAME β¨
nn_get_statistic β pull statistics out of a nanomsg socket, no cap π
πΈ SYNOPSIS πΈ
#include <nanomsg/nn.h>
uint64_t nn_get_statistic (int s, int statistic);
π¦ DESCRIPTION π¦
So basically this grabs the value of one specific statistic from your socket. That's it, that's the whole vibe. π
Caution β the API itself is stable, but these statistics are for humans. Like, they exist so you can observe and debug stuff, okay? The actual stats and what they mean are unstable and can change without anyone telling you. So do not build a program that depends on any particular statistic existing, or on its value meaning anything. fr fr. π
The nanomsg core framework keeps these ones up to date. There may be other statistics hanging around too β those are undocumented, so don't try to read into them, literally just leave them alone. Also, not every statistic makes sense for every transport! For example, the nn_inproc(7) transport doesn't maintain any of the connection-related statistics at all. π«Ά
NN_STAT_ESTABLISHED_CONNECTIONSβ how many connections got successfully established that were started from this socket.NN_STAT_ACCEPTED_CONNECTIONSβ how many connections got successfully established that this socket accepted.NN_STAT_DROPPED_CONNECTIONSβ how many established connections this socket dropped. πNN_STAT_BROKEN_CONNECTIONSβ how many established connections this socket closed, usually because of protocol errors. πNN_STAT_CONNECT_ERRORSβ how many errors this socket hit while trying to connect to a remote peer.NN_STAT_BIND_ERRORSβ how many errors this socket hit while trying to bind to a local address.NN_STAT_ACCEPT_ERRORSβ how many errors this socket hit while trying to accept a connection from a remote peer.NN_STAT_CURRENT_CONNECTIONSβ how many connections are established to this socket right now. βNN_STAT_MESSAGES_SENTβ how many messages this socket sent. π€NN_STAT_MESSAGES_RECEIVEDβ how many messages this socket received. π₯NN_STAT_BYTES_SENTβ how many bytes this socket sent.NN_STAT_BYTES_RECEIVEDβ how many bytes this socket received.
π₯ RETURN VALUE π₯
If it worked, you get the value of the statistic. If it didn't, you get (uint64_t)-1. that's the whole deal π
π ERRORS π
EINVALβ that statistic is invalid or unsupported. nope, not a thing bestie.EBADFβ the socket you handed over is invalid.ETERMβ the library is terminating. it's over, it's done, we're shutting down. π
π§ EXAMPLE π§
val = nn_get_statistic (s, NN_STAT_MESSAGES_SENT);
if (val == 0)
printf ("No messages have been sent yet.\n");
π SEE ALSO π
nn_errno(3) nn_symbol(3) nanomsg(7)
π AUTHORS π
Garrett DβAmore <garrett@damore.org> β ty king πββοΈ
and that's the page!! this one is from the nanomsg 1.2.2 manual, dated 2026-01-16, and it's literally called NN_GET_STATISTIC(3). go forth and count your messages bestie πβ¨π¦
π¦ 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