netcat

Sending files

Sometime, you need to send a file from a remote machine, the source, to another remote machine, the destination. The SSH access to the machines is allowed from your computer, but not between them.
We can hence use the nc command if the firewall rules allow it.

On the machine destination:

nc -l -p 1234 | uncompress -c | tar xvfp -

On the machine source:

tar cfp - /a/path | compress -c | nc machine_destination 1234

The nc command don’t provide any mechanism to check the quality of the transfered data (no re-transfer nor retry).
A good quality of the connexion is necessary (plus a checksum).