Ncat was written to make piping data between hosts easy. It has a syntax similar to cat, but allows tcp streams to be specified in addition to regular files.
The Ncat archive also includes an RPM spec file. RPM users can build a binary package ready to install by running:
rpm -tb ncat-1.0.1.tar.gzYou will find the binary rpm under /usr/src/rpm/RPMS/i386 or /usr/src/redhat/RPMS/i386.
There is another featureful tool called "netcat" but it is bidirectional (unlike cat) and doesn't work well in a uni directional pipe. Also I've noticed "netcat" causes a massive amount of collisions over my ethernet bringing any data transfer to its knees. For me, Ncat causes minimum collosions and transfers data at the maximum rate possible.
Ncat allows me to backup several machines across my LAN straight to CD without needing any temporary disk space.
See ncat(1) for more detailed information about the command.
Machine one has a growing logfile you would like to print in real time on machine two's lp0 dot matrix printer:
- # tail -f logfile | ncat -o :0
ncat: listening on port 3724
- # ncat one:3724 > /dev/lp0
Machine two is slow, so you would like to do the log processing on machine one instead:
- # ncat :4321 | analyze
- # ncat -o one:4321 example.log