NN_CONNECT(3compat)
π NN_CONNECT (3compat) β the nng reference manual, bestie edition π
okay so real talk, this one lives in the 3compat section of the NNG Reference Manual β it's the legacy-compatibility corner of the house, and it's giving "vintage but still slaps" β¨
β¨ NAME β¨
nn_connect β connect to a remote peer (the compatible API version, iykyk) π¦
πΈ SYNOPSIS πΈ
#include <nanomsg/nn.h>
int nn_connect(int sock, const char *url)
π DESCRIPTION π
So nn_connect() is the function that arranges for the socket sock to initiate a connection to a peer at the address specified by url. That's the whole vibe. π«Ά
On success, it hands you back an identifier for this socket's association with the url β like a little friendship bracelet π for that connection. Keep it! You can pass that identifier to nn_shutdown() later to remove the association when you're done.
Note β this function is here purely for API compatibility with legacy libnanomsg. Lowkey consider using the relevant modern API instead. β¨
Note β the connect operation is performed asynchronously, so it may not have completed by the time this function returns control to you. Basically it's out the door before the text is even delivered, no cap. π
Important β only transports supported by legacylibnanomsgmay be used with this function. Specifically, only the schemestcp://,ipc://,inproc://, andws://are supported here. (If you want the other schemes, use the modern API, bestie. fr fr.)
π RETURN VALUES π
This function returns a positive identifier on success, and -1 on error. That's it, that's the whole deal. π
π₯ ERRORS π₯
ECONNREFUSEDβ the connection attempt was refused. rude of them honestly πEBADFβ the socketsockis not open. girl. open the socket first πEINVALβ an invalidurlwas supplied.
π SEE ALSO π
nn_bind(3compat), nn_errno(3compat), nn_shutdown(3compat), nn_socket(3compat), nn_compat(3compat), nng(7)
π¦ and that's the page!! source/version + date tea for the girlies keeping receipts: this bad boy is dated 2026-01-13 and belongs to NN_CONNECT(3compat) β periodt, go connect some sockets bestie πβπ§
π¦ where this page comes from
- alpine 3.24: nng-doc 1.11-r0 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms