WhitSoft Development
AIM Certificates  |  SlimFTPd  |  Trayconizer  |  UnFREEz  |  Help/Contact Wednesday, 28 September 2022

netpipe r245

Netpipe is a Linux console utility that redirects its standard input and output streams over a TCP/IP socket connection. When combined with the shell's I/O redirection facilities, netpipe is a powerful tool that lets you pipe data between processes running on different machines.


netpipe [host] port

host can be a dotted decimal IP address or a host name.

Example #1 — Transferring a file

Passive Receiver / Active Sender

1. On receiving machine (barry):

netpipe 12345 < /dev/null > myfile

2. On sending machine (frank):

netpipe barry 12345 < myfile
— or —

Passive Sender / Active Receiver

1. On sending machine (frank):

netpipe 54321 < myfile

2. On receiving machine (barry):

netpipe frank 54321 < /dev/null > myfile

Either of these two methods will accomplish the transmission of myfile from frank to barry. The difference is in which machine is listening for the incoming connection. The listening process must be started first. The other machine establishes an outgoing connection to it.

Important: Netpipe treats stdin and stdout independently, and the connection will only be closed after stdin on both sides has been closed. In many cases, this means you need to redirect stdin from /dev/null, as is done in these examples. If you don't redirect stdin, you will need to type Ctrl+D to send an EOF to netpipe.

Example #2 — Compressing a file using another machine

1. On machine with the file (carlos):

netpipe 5000 < myfile &
netpipe 5001 < /dev/null > myfile.bz2

2. On machine doing the compressing (rita):

netpipe carlos 5000 < /dev/null | bzip2 -c | netpipe carlos 5001

Note that this example has carlos listening on two ports and rita connecting to those two ports, but there are three other permutations of connection orientations that would work just as well.

Again, the important thing is to ensure that stdin comes from somewhere — from /dev/null if you don't want to send anything from that side.

Download netpipe, pre-compiled for Linux: i386 x86_64

Download netpipe, pre-compiled for Mac OS X: i386

Download netpipe source code (public domain)

This site is hosted by DreamHost Web Hosting.

© 1999-2022 WhitSoft Development and Matt Whitlock