'\" t
.\" Title: nanocat
.\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets v1.79.1
.\" Date: 04/25/2016
.\" Manual: nanomsg manual
.\" Source: nanomsg
.\" Language: English
.\"
.TH "NANOCAT" "1" "04/25/2016" "nanomsg" "nanomsg manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
nanocat \- a command\-line interface to nanomsg
.SH "SYNOPSIS"
.sp
.nf
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]
.fi
.sp
In the case symlinks are installed:
.sp
.nf
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]
.fi
.SH "DESCRIPTION"
.sp
The nanocat is a command\-line tool to send and receive data via nanomsg sockets\&. It can be used for debugging purposes, sending files through the network, health checking the system or whatever else you can think of\&.
.SH "OPTIONS"
.sp
Generic:
.PP
\fB\-\-verbose,\-v\fR
.RS 4
Increase verbosity of the nanocat
.RE
.PP
\fB\-\-silent,\-q\fR
.RS 4
Decrease verbosity of the nanocat
.RE
.PP
\fB\-\-help,\-h\fR
.RS 4
This help text
.RE
.sp
Socket Types:
.PP
\fB\-\-push\fR
.RS 4
Use NN_PUSH socket type
.RE
.PP
\fB\-\-pull\fR
.RS 4
Use NN_PULL socket type
.RE
.PP
\fB\-\-pub\fR
.RS 4
Use NN_PUB socket type
.RE
.PP
\fB\-\-sub\fR
.RS 4
Use NN_SUB socket type
.RE
.PP
\fB\-\-req\fR
.RS 4
Use NN_REQ socket type
.RE
.PP
\fB\-\-rep\fR
.RS 4
Use NN_REP socket type
.RE
.PP
\fB\-\-surveyor\fR
.RS 4
Use NN_SURVEYOR socket type
.RE
.PP
\fB\-\-respondent\fR
.RS 4
Use NN_RESPONDENT socket type
.RE
.PP
\fB\-\-bus\fR
.RS 4
Use NN_BUS socket type
.RE
.PP
\fB\-\-pair\fR
.RS 4
Use NN_PAIR socket type
.RE
.sp
Socket Options:
.PP
\fB\-\-bind\fR \fIADDR\fR
.RS 4
Bind socket to the address ADDR
.RE
.PP
\fB\-\-connect\fR \fIADDR\fR
.RS 4
Connect socket to the address ADDR
.RE
.PP
\fB\-\-bind\-ipc,\-X\fR \fIPATH\fR
.RS 4
Bind socket to the ipc address "ipc://PATH"\&.
.RE
.PP
\fB\-\-connect\-ipc,\-x\fR \fIPATH\fR
.RS 4
Connect socket to the ipc address "ipc://PATH"\&.
.RE
.PP
\fB\-\-bind\-local,\-L\fR \fIPORT\fR
.RS 4
Bind socket to the tcp address "tcp://127\&.0\&.0\&.1:PORT"\&.
.RE
.PP
\fB\-\-connect\-local,\-l\fR \fIPORT\fR
.RS 4
Connect socket to the tcp address "tcp://127\&.0\&.0\&.1:PORT"\&.
.RE
.PP
\fB\-\-recv\-timeout\fR \fISEC\fR
.RS 4
Set timeout for receiving a message
.RE
.PP
\fB\-\-send\-timeout\fR \fISEC\fR
.RS 4
Set timeout for sending a message
.RE
.sp
SUB Socket Options:
.PP
\fB\-\-subscribe\fR \fIPREFIX\fR
.RS 4
Subscribe to the prefix PREFIX\&. Note: socket will be subscribed to everything (empty prefix) if no prefixes are specified on the command\-line\&.
.RE
.sp
Input Options:
.PP
\fB\-\-format\fR \fIFORMAT\fR
.RS 4
Use echo format FORMAT (same as the options below)
.RE
.PP
\fB\-\-raw\fR
.RS 4
Dump message as is (Note: no delimiters are printed)
.RE
.PP
\fB\-\-ascii,\-A\fR
.RS 4
Print ASCII part of message delimited by newline\&. All non\-ascii characters replaced by dot\&.
.RE
.PP
\fB\-\-quoted,\-Q\fR
.RS 4
Print each message on separate line in double quotes with C\-like character escaping
.RE
.PP
\fB\-\-msgpack\fR
.RS 4
Print each message as msgpacked string (raw type)\&. This is useful for programmatic parsing\&.
.RE
.sp
Output Options:
.PP
\fB\-\-interval,\-i\fR \fISEC\fR
.RS 4
Send message (or request) every SEC seconds
.RE
.PP
\fB\-\-delay,\-d\fR \fISEC\fR
.RS 4
Wait for SEC seconds before sending message (useful for one\-shot PUB sockets)
.RE
.PP
\fB\-\-data,\-D\fR \fIDATA\fR
.RS 4
Send DATA to the socket and quit for PUB, PUSH, PAIR, BUS socket\&. Use DATA to reply for REP or RESPONDENT socket\&. Send DATA as request for REQ or SURVEYOR socket\&.
.RE
.PP
\fB\-\-file,\-F\fR \fIPATH\fR
.RS 4
Same as \-\-data but get data from file PATH
.RE
.SH "EXAMPLES"
.sp
The ping\-pong with nn_req/nn_rep sockets (must be run simultaneously):
.sp
.if n \{\
.RS 4
.\}
.nf
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
.fi
.if n \{\
.RE
.\}
.sp
Or in shorter to write form:
.sp
.if n \{\
.RS 4
.\}
.nf
nn_rep \-L1234 \-Dpong \-A
nn_req \-l1234 \-Dping \-A
.fi
.if n \{\
.RE
.\}
.sp
Do periodic requests once a second:
.sp
.if n \{\
.RS 4
.\}
.nf
nn_req \-l1234 \-Dping \-A \-i 1
.fi
.if n \{\
.RE
.\}
.sp
The rep socket that never reply (no \-D option), may be used to check if resending the requests is actually work:
.sp
.if n \{\
.RS 4
.\}
.nf
nanocat \-\-rep \-\-connect ipc:///var/run/app/req\&.socket
.fi
.if n \{\
.RE
.\}
.sp
Send an output of the ls to whatever would connect to 127\&.0\&.0\&.1:1234 then exit:
.sp
.if n \{\
.RS 4
.\}
.nf
ls | nanocat \-\-push \-L1234 \-F\-
.fi
.if n \{\
.RE
.\}
.sp
Send heartbeats to imaginary monitoring service:
.sp
.if n \{\
.RS 4
.\}
.nf
nanocat \-\-pub \-\-connect tpc://monitoring\&.example\&.org \-D"I am alive!" \-\-interval 10
.fi
.if n \{\
.RE
.\}
.SH "SEE ALSO"
.sp
\fBnanomsg\fR(7)
.SH "AUTHORS"
.sp
Paul Colomiets