Socat is a powerful file transfer tool. It reduced the overhead of other transfer protocols and can come in considerably handy when transferring files over networks with high latency.
When compiling the socat tool we got the following error on linux:
/usr/bin/install: target `/usr/local/man/man1/’ is not a directory: No such file or directory
make: *** [install] Error 1
To remedy this issue you simply need to create the directory that is missing
mkdir -p /usr/local/man/man1
Configure once again. Once it is installed you can transfer directories with files as follows.
On the destination host you will need to bind the application to the port and listening. To do this you can use the following command:
socat TCP-LISTEN:6000 OPEN:destination.tar,create,append
The port is arbitrary. The file will be created as destination.tar, and if it doesn’t exist it will be created. If it exists, it will be appended.
On the source host we will need to specify what directory to send. Once we choose we will utilize the tar command to bundle everything up to one file that we can send to the destination. The command to do this is as follows:
tar cf – sourcedir | socat TCP:destinationhost:6000 –
This will bundle the source directory and send the file via TCP to the destination host on the port we specify. On the destination host simply untar the file to access the contents.