.TH vznnc 8 "29 May 2014" "OpenVZ" "Containers"
.SH NAME
vznnc \- run a program connected to a socket
.SH SYNOPSIS
.SY vznnc
{
.B -l
|
.B -c
}
.B -p
.I port
.OP -f fd
.OP --
.I program
[\fIarg\fR \fI...\fR]
.SH DESCRIPTION
This "nano-netcat" utility can be used to either listen on or connect to
a TCP port at localhost, and run a specified \fIprogram\fR with its stdin
and stdout (or a specified file descriptor) connected to the socket.

.SH OPTIONS
.TP
.B -l
Listen on a specified TCP port at localhost.
.TP
.B -c
Connect to a specified TCP port at localhost.
.TP
\fB-p\fR \fIport\fR
Port number.
.TP
\fB-f\fR \fIfd\fR
File descriptor ID. If this option is not set, stdin and stdout are closed
and are connected to the socket, otherwise they are left intact, and the
specified \fIfd\fR is used.
.TP
.B --
This is a separator between
.B vznnc
own arguments and
.I program
arguments, so that latter won't be processed by
.BR vznnc .
It is required in case there are any arguments to
.I program
that start with the dash
.RB ( - )
character, and is optional otherwise.
.TP
\fIprogram\fR [ \fIarg\fR \fI...\fR ]
Program to run, with optional arguments.
.SH EXIT STATUS
Returns \fIprogram\fR exit status upon success, or one of the following
codes in case of an error:
.IP 1
Invalid usage
.IP 127
Error executing \fIprogram\fR.
.IP 220
Network-related error.
.SH EXAMPLES
To run receiving side of
.B ploop copy
command on a remote server, using openssh port forwarding:

.EX
 PORT=2345
 ssh -L localhost:$PORT:localhost:$PORT $REMOTE_SERVER \\
	vznnc -l -p $PORT -- ploop copy -d $FILE -i0 -o1
.EE

To do the same, but with stdin and stdout intact, using file descriptor 5
for communication:

.EX
 ssh -L localhost:$PORT:localhost:$PORT $REMOTE_SERVER \\
	vznnc -l -p $PORT -f 5 -- ploop copy -d $FILE -i5 -o5
.SH SEE ALSO
.BR nc (3),
.BR netcat (3),
.BR socat (2).
.SH LICENSE
Copyright (C) 2014, Parallels, Inc. Licensed under GNU GPL v2.
