Interesting thing with Netcat (nc) in CentOS 5 or 6 (nc-1.84-10.fc6 or nc-1.84-22.el6.x86_64). How can I work it around? I can't find a bug about this, but
It models a file transfer to a remote host, where the file is transformed, then the result is sent back. In this example transformation is "cat".
The server (localhost):
$ mkfifo nctest.fifo
$ while :; do
nc -l 5000 <nctest.fifo | cat >nctest.fifo
echo -n .
sleep 1
done
The client (localhost):
$ cat testfile | nc 127.0.0.1 5000 > outfile
$ ls -l
total 9724
prw-r--r-- 1 root root 0 Nov 4 14:17 nctest.fifo
-rw-r--r-- 1 root root 4930560 Nov 4 14:17 outfile
-rw-r--r-- 1 root root 5000000 Nov 4 14:09 testfile
Outfile's size varies from zero to 5000000. I can add "-w2" to client, but it's no use.