I'm trying to set up a simple socat fileserver using TCP to send small files (~100KB).
Here are the one-line servers and client for one file:
Server: socat -u -d -d OPEN:file.dat TCP-LISTEN:<port>,reuseaddr,fork
Client: socat -u -d -d TCP:<server>:<port> OPEN:file.dat,creat
The first data transfer always works, but the following are not always working. Most of the following transfer create an empty file on the client-side. The problem persists with multiple clients transfering once, and I veryfied that data is not transfered when the bug occurs, but the log and return values doesn't indicate any errors, just a shorter data loop.
I tried pretty much every option mentionned here: http://www.dest-unreach.org/socat/doc/socat.html
The only way I found to make it work multiple consecutive times is to remove the fork option from the server listenner and to wrap the whole commande line in a bash loop, but of course it fails for multiple clients.
I tried with Ubuntu, Fedora, Redhat and FreeBSD.
Am I missing something or is this a bug ?