NNGCAT(1)
πΈ NNGCAT(1) β the NNG Reference Manual, but make it a group chat π
okay bestie, sit DOWN. this is nngcat, and it's the little command-line bestie that gives you access to the Scalability Protocols without you having to write a single line of C. slay.
β¨ NAME β¨
nngcat β command line access to Scalability Protocols. yes that's it, that's the whole name, she's simple and she's iconic π
π¦ SYNOPSIS π¦
nngcat --help
nngcat --version
nngcat [OPTION]...
π DESCRIPTION π
So. The nngcat utility is the way you get command line access to the Scalability Protocols, fr fr. What that means in practice: you can write shell scripts that talk to other peers in a Scalability Protocols topology β sending messages AND receiving messages β no compilation required. it's giving "I just want to vibe with my network from bash" and honestly? valid. π«Ά
π OPTIONS π
The possible values for OPTION are described below. buckle up, there's a lot, but I got you.
π‘ Tip: Thenngcatutility accepts shortened versions of these options, as long as the supplied option is unambiguous. For example--compcan be used in lieu of--compat, but--remay not be used for anything because it could mean any of--req,--rep, or--respondent. so like, be specific, bestie π
When using the long form of an option (names prefixed with with --), if the option takes a value then the value may be supplied by appending the option with an equals sign and the value (e.g. --subscribe=times), by appending the option with a colon and the value (e.g. --subscribe:tribune) or by providing the data as the next program argument (e.g. --subscribe herald). three ways, pick your fave π
When using short form options (a single letter prefixed with a -), if the option takes a value it may either be immediately appended to the value (e.g. -L5678) or provided as the next program argument (e.g. -L 5678).
β οΈ POSIX style option clustering of single letter options is not supported; each option must be presented as a separate argument to the program. no -abc stacking, she's not that kind of girl π
π Generic Options π
-h,--helpβ Get usage help. the "help me I'm baby" button.-V,--versionβ Print the version and exit. short and sweet.-v,--verboseβ Select verbose operation. she tells you EVERYTHING.-q,--silentβ Select silent operation. she tells you NOTHING. π€«--compatβ Compatible mode. This causenngcatto behave more like the legacynanocatapplication. In this mode connections are made asynchronously, and the--pairoption selects version 0 of the pair protocol instead of version 1. retro mode activated π--subscribe=TOPICβ Subscribe toTOPIC. This option can only be used with thesubprotocol. TheTOPICis checked against the first bytes of messages received, and messages are discarded if they do not match. This may be specified multiple times to subscribe to multiple topics. If not specified at all, then a default subscription to everything is assumed. so if you say nothing, you get everything, which is honestly a whole mood β¨--count==COUNTβ Limit the number of iterations when looping toCOUNTiterations. For protocols that only send, this will only sendCOUNTmessages before exiting. For protocols that only receive, this will only receiveCOUNTmessages before exiting. For protocols that involve a full exchange, this will only performCOUNTexchanges (each exchange is characterized by at most a single send, and one or more receives.) IfCOUNTis zero, then an infinite number of iterations is performed. zero means forever, no cap π
π Protocol Selection Options π
π Note: At least one protocol must be selected. you can't just show up with no protocol, that's not a lewk.
--bus,--bus0β Select the bus version 0 protocol. This protocol can send and receive messages to and from other bus version 0 peers. the group chat of protocols.--req,--req0β Select the req version 0 protocol. This protocol sends messages to rep version 0 peers and receives replies from them. she asks, she receives. main character energy.--rep,--rep0β Select the rep version 0 protocol. This protocol receives messages from req version 0 peers and can send replies to them. the one who always answers in the chat.--pub,--pub0β Select the pub version 0 protocol. This protocol sends messages to sub version peers. she posts, she doesn't read replies. iconic.--sub,--sub0β Select the sub version 0 protocol. This protocol receives messages from pub version 0 peers, and filters them based on subscriptions set with--subscribe. lurking, but with β¨intentionβ¨.--push,--push0β Select the push version 0 protocol. This protocol sends messages to pull version 0 peers. A given message is normally only delivered to a single peer. she's not about that broadcasting life.--pull,--pull0β Select the pull version 0 protocol. This protocol receives messages from push version 0 peers. catches whatever push sends. π--pair0β Select the pair version 0 protocol. This protocol can send and receive messages with one connected pair version 0 peer. just the two of you, bestie.--pair1β Select the pair version 1 protocol. This protocol can send and receive messages with one connected pair version 1 peer. It is not supported in--compatmode. (Polyamorous mode is not supported innngcat, although peers may be using polyamorous mode.) oop β the polyamory is peer-side only, nngcat is monogamous here π--pairβ Acts as an alias for--pair1, unless--compatmode is selected, in which case it acts as an alias for--pair0. she adapts to her environment, versatile queen.--surveyor,--surveyor0β Select the surveyor version 0 protocol. This protocol sends a survey request to respondent version 0 peers, and then receives replies from them. poll the group, collect the tea β--respondent,--respondent0β Select the respondent version 0 protocol. This protocol receives survey requests from surveyor version 0 peers, and can send a reply to them. she always has something to say.
π§ Peer Selection Options π§
π Note: At least one peer address must be selected.
π‘ Tip: While legacynanocatonly supported one peer,nngcatcan support more than one peer on a given connection. glow up fr fr π₯
--connect,--dial=URLβ Connect to the peer at the address specified byURL.--bind,--listen=URLβ Bind to, and accept connections from peers, at the address specified byURL.-x,--connect-ipc=PATHβ Connect to the IPC path specified byPATH. This is the same as--connect=ipc://PATH.-X,--bind-ipc=PATHβ Bind to the IPC path specified byPATH. This is the same as--bind=ipc://PATH.-l,--connect-local=PORTβ Connect to localhost at the TCP port specified byPORT. This is the same as--connect=tcp://127.0.0.1:PORT.-L,--bind-local=PORTβ Bind to the TCP port specified byPORT. This is the same as--bind=tcp://127.0.0.1:PORT.
β Receive Options β
Data messages received can be formatted in different ways. These options can only be specified when using a protocol that receives messages. if your protocol doesn't receive, these do literally nothing, don't waste your time π
-A,--asciiβ The same as specifying--format=ascii.-Q,--quotedβ The same as specifying--format=quoted.--hexβ The same as specifying--format=hex.--msgpackβ The same as specifying--format=msgpack.--rawβ The same as specifying--format=raw.--receive-timeout=SECβ Give up receiving messages afterSECseconds pass without any received messages. she waits, but not forever, she has boundaries β--recv-maxsz=COUNTβ Set the maximum message size socket will accept toCOUNTbytes. Messages larger than this will be discarded. The default is1048576(1 MB). To eliminate any restriction, use0. big messages? not on her watch. unless you say0, then she's chill about it.--format=FORMATβ Format data as indicated. TheFORMATcan be any of:noβ No output at all. she's giving absolutely nothing and that's on purpose πrawβ Raw output, every byte received is sent to standard output.asciiβ ASCII safe, printable ASCII is emitted verbatim, with other bytes substituted with.(period).quotedβ Messages are printed as quoted strings, using C language conventions.hexβ Messages are printed as quoted strings, with every byte appearing as an escaped hexadecimal value, such as\x2E.msgpackβ Messages are emitted as MessagePack <https://msgpack.org> "bin format" (byte arrays).
π Transmit Options π
Protocols that support sending data can use these options to select the data. go on, send the message, bestie π¨
-D,--data=DATAβ UseDATAfor the body of outgoing messages.-F,--file=FILEβ UseFILEfor the body of outgoing messages. IfFILEis-the message body will be read from standard input. cute little shortcut, obsessed.-i,--interval=SECβ For protocols that send unsolicited data (as opposed to those that send data only in response to received messages), this will resend the outgoing message at repeating intervals ofSECseconds. she will NOT stop posting. π-d,--delay=SECβ WaitSECseconds before sending the first outgoing message. This is useful to let connections establish before sending data, thereby avoiding message loss. be patient, let the connection cook first π³--send-timeout=SECβ Give up trying to send a message afterSECseconds. no message is worth waiting forever for, periodt.
π TLS Options π
These options are only present if TLS is configured; they are ignored when using addresses that are not secured with TLS. so if you're not doing TLS, these are just sitting there, decorative β¨
-k,--insecureβ Skip peer validation. yes, that's the dangerous one, that's the "I'm choosing chaos" one, know that going in π-E,--cert=FILEβ Load own certificate fromFILE.--key=FILEβ Load own key fromFILE. Should be used in conjunction with--cert. If not specified, and--certis specified, then a single file containing both the private key and the associated certificate is assumed.--cacert=FILEβ Load CA certificates fromFILE. These CAs ("Certificate Authorities") are used as trust roots when validating certificates presented by peers.
π ZeroTier Options π
These options are only present if ZeroTier is configured; they are ignored otherwise. same deal, only relevant if you signed up π
--zt-home=DIRECTORYβ Directory for persistent ZeroTier node (key material, etc.) This directory must already exist. Only one program may use a ZeroTier node at a time; file locking is used to prevent this. so like, mkdir first, and don't fight your other programs over it, sharing is not caring here π
π EXAMPLES π
Echo service using request/reply.
$ addr="tcp://127.0.0.1:4567"
$ nngcat --rep --listen=${addr} --data="42" --quoted &
$ nngcat --req --dial=${addr} --data="what is the answer?" --quoted
"what is the answer?"
"42"
Send a chime every hour (3600 seconds).
$ addr=ipc:///grandpa_clock
$ nngcat --pub --listen=${addr} --data "cuckoo" --interval 3600 &
$ nngcat --sub --dial=${addr} --quoted &
"cuckoo"
look at that. a whole working topology in six lines. she ate and left no crumbs π
π«Ά SEE ALSO π«Ά
libnng(3), nng(7), nng_bus(7), nng_pair(7), nng_pub(7), nng_pull(7), nng_push(7), nng_sub(7), nng_rep(7), nng_req(7), nng_respondent(7), nng_surveyor(7)
go read those too, iykyk, the lore goes deep π
and that's the whole vibe, bestie π this beauty shipped as part of the NNG Reference Manual β dated 2026-10-13 β and she goes by NNGCAT(1) around these parts. go send a message or something, you got this. π¦β¨
π¦ where this page comes from
- fedora 43: nng-utils 1.12.3-1.fc43 Β· MIT
- fedora 44: nng-utils 1.12.3-1.fc44 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms