NANOCAT(1)

πŸŽ€ NANOCAT πŸŽ€

okay bestie, sit down, hydrate, and let me tell you about nanocat(1) β€” she's the command-line girlie from nanomsg version 1.2.2, and she is lowkey iconic. if you've ever wanted to yeet data across a network from your shell like it's nothing, this is your moment. ✨


πŸ’– NAME πŸ’–

nanocat β€” a command-line interface to nanomsg. that's the whole vibe. 🫢


✨ SYNOPSIS ✨

the main-character lineup, one per socket type:

nanocat --req {--connect ADDR|--bind ADDR} {--data DATA|--file PATH} [-i SEC] [-AQ]
nanocat --rep {--connect ADDR|--bind ADDR} {--data DATA|--file PATH} [-AQ]
nanocat --push {--connect ADDR|--bind ADDR} {--data DATA|--file PATH} [-i SEC]
nanocat --pull {--connect ADDR|--bind ADDR} [-AQ]
nanocat --pub {--connect ADDR|--bind ADDR} {--data DATA|--file PATH} [-i SEC]
nanocat --sub {--connect ADDR|--bind ADDR} [--subscribe PREFIX ...] [-AQ]
nanocat --surveyor {--connect ADDR|--bind ADDR} {--data DATA|--file PATH} [-i SEC] [-AQ]
nanocat --respondent {--connect ADDR|--bind ADDR} {--data DATA|--file PATH} [-AQ]
nanocat --bus {--connect ADDR|--bind ADDR} {--data DATA|--file PATH} [-i SEC] [-AQ]
nanocat --pair {--connect ADDR|--bind ADDR} {--data DATA|--file PATH} [-i SEC] [-AQ]

and if the symlinks happen to be installed, you get these glow-up short names instead β€” same energy, fewer letters:

nn_req {--connect ADDR|--bind ADDR} {--data DATA|--file PATH} [-i SEC] [-AQ]
nn_rep {--connect ADDR|--bind ADDR} {--data DATA|--file PATH} [-AQ]
nn_push {--connect ADDR|--bind ADDR} {--data DATA|--file PATH} [-i SEC]
nn_pull {--connect ADDR|--bind ADDR} [-AQ]
nn_pub {--connect ADDR|--bind ADDR} {--data DATA|--file PATH} [-i SEC]
nn_sub {--connect ADDR|--bind ADDR} [--subscribe PREFIX ...] [-AQ]
nn_surveyor {--connect ADDR|--bind ADDR} {--data DATA|--file PATH} [-i SEC] [-AQ]
nn_respondent {--connect ADDR|--bind ADDR} {--data DATA|--file PATH} [-AQ]
nn_bus {--connect ADDR|--bind ADDR} {--data DATA|--file PATH} [-i SEC] [-AQ]
nn_pair {--connect ADDR|--bind ADDR} {--data DATA|--file PATH} [-i SEC] [-AQ]

🌈 DESCRIPTION 🌈

so nanocat is a command-line tool for sending and receiving data through nanomsg sockets. that's it. that's her job and she does it flawlessly. πŸ’…

and like, what do you do with that? the manpage says: debugging (obvi), sending files through the network (yes really), health checking the system (she's a doctor too), or honestly whatever else you can think of β€” the limit is literally your imagination, bestie. πŸ¦‹


πŸ”₯ OPTIONS πŸ”₯

🌸 Generic 🌸

  • --verbose, -v β€” crank the verbosity of the nanocat up. more talking, more details.
  • --silent, -q β€” drop the verbosity of the nanocat down. shhh, she's being mysterious. 🀫
  • --help, -h β€” this help text. she explains herself when asked.

🌟 Socket Types 🌟

pick your girl. one of these, please:

  • --push β€” use NN_PUSH socket type
  • --pull β€” use NN_PULL socket type
  • --pub β€” use NN_PUB socket type
  • --sub β€” use NN_SUB socket type
  • --req β€” use NN_REQ socket type
  • --rep β€” use NN_REP socket type
  • --surveyor β€” use NN_SURVEYOR socket type
  • --respondent β€” use NN_RESPONDENT socket type
  • --bus β€” use NN_BUS socket type
  • --pair β€” use NN_PAIR socket type

πŸ”Œ Socket Options πŸ”Œ

  • --bind ADDR β€” bind the socket to the address ADDR
  • --connect ADDR β€” connect the socket to the address ADDR
  • --bind-ipc, -X PATH β€” bind the socket to the ipc address "ipc://PATH".
  • --connect-ipc, -x PATH β€” connect the socket to the ipc address "ipc://PATH".
  • --bind-local, -L PORT β€” bind the socket to the tcp address "tcp://127.0.0.1:PORT".
  • --connect-local, -l PORT β€” connect the socket to the tcp address "tcp://127.0.0.1:PORT".
  • --recv-timeout SEC β€” set the timeout for receiving a message
  • --send-timeout SEC β€” set the timeout for sending a message

🎧 SUB Socket Options 🎧

  • --subscribe PREFIX β€” subscribe to the prefix PREFIX. note: the socket will be subscribed to everything (that's an empty prefix) if no prefixes are specified on the command-line. she's a yes-girl by default, periodt.

πŸ“₯ Input Options πŸ“₯

  • --format FORMAT β€” use echo format FORMAT (same as the options below)
  • --raw β€” dump the message as is. (note: no delimiters are printed)
  • --ascii, -A β€” print the ASCII part of the message delimited by newline. all non-ascii characters get replaced by a dot.
  • --quoted, -Q β€” print each message on a separate line in double quotes with C-like character escaping
  • --msgpack β€” print each message as a msgpacked string (raw type). this one's for the girlies doing programmatic parsing πŸ’»

πŸ“€ Output Options πŸ“€

  • --interval, -i SEC β€” send a message (or a request) every SEC seconds. she's consistent. she's reliable. she's that girl.
  • --delay, -d SEC β€” wait SEC seconds before sending the message (super useful for one-shot PUB sockets)
  • --data, -D DATA β€” send DATA to the socket and quit, for PUB, PUSH, PAIR, BUS sockets. use DATA to reply for REP or RESPONDENT sockets. send DATA as a request for REQ or SURVEYOR sockets. one flag, three whole personalities. πŸ’…
  • --file, -F PATH β€” same as --data but it gets the data from the file PATH

🌸 EXAMPLES 🌸

the classic ping-pong with nn_req/nn_rep sockets β€” and bestie, these must be run simultaneously, no cap, two terminals or it's not happening:

nanocat --rep --bind tcp://127.0.0.1:1234 --data pong --format ascii
nanocat --req --connect tcp://127.0.0.1:1234 --data ping --format ascii

or, if you want the shorter-to-write form, she also comes in snack size:

nn_rep -L1234 -Dpong -A
nn_req -l1234 -Dping -A

do periodic requests, once every second, like clockwork πŸ•:

nn_req -l1234 -Dping -A -i 1

the rep socket that never replies (that's the no--D-option lifestyle) β€” this one is genuinely useful for checking whether the resending of requests is actually working:

nanocat --rep --connect ipc:///var/run/app/req.socket

send the output of ls to whatever would connect to 127.0.0.1:1234 and then dip:

ls | nanocat --push -L1234 -F-

and finally, send heartbeats to an imaginary monitoring service, because even fictional infrastructure deserves love πŸ’–:

nanocat --pub --connect tcp://monitoring.example.org -D"I am alive!" --interval 10

πŸ‘€ SEE ALSO πŸ‘€

nanomsg(7) β€” go read the big one, she's the parent lore.


πŸ‘‘ AUTHORS πŸ‘‘

Paul Colomiets <paul@colomiets.name> β€” the icon, the legend, the one who made her. 🌟


and that's the whole page, bestie! this was nanocat(1) from nanomsg version 1.2.2, dated 2026-01-16. go forth and socket responsibly. πŸŽ€βœ¨πŸ’…πŸ¦‹

πŸ“¦ where this page comes from