Date: Tue, 04 Sep 2012 04:41:21 +0930 From: Wayne Sierke <ws@au.dyndns.ws> To: freebsd-questions <freebsd-questions@freebsd.org> Subject: Combining netcat with fifos results in stuck queues/sbwait Message-ID: <1346699481.13805.42.camel@predator-ii.buffyverse>
next in thread | raw e-mail | index | archive | help
I was hoping to establish a simple processing server using nc(1). After finding numerous examples of combining netcat with fifos (named pipes) I am unable to establish a reliable setup. E.g. following the example of the canonical netcat server: server: #mkfifo backpipe #nc -l 4242 < backpipe | tr -u "[:lower:]" "[:upper:]" > backpipe client: #mkfifo frontpipe #nc localhost 4242 < frontpipe > testfile.out & #cat testfile.in > frontpipe For any non-trivially small testfile I inevitably end up with the processes at both ends stuck in sbwait. I have managed to avoid the stuck condition by setting the TCP buffer sizes at both ends: nc -I 2048 -O 1024 with a resulting throughput of ~40kB/s (and a supplementary problem of truncation). There are other oddities, such as not using the fifo on the client end: #nc -I 2048 -O 1024 localhost 4242 < testfile.in > testfile.out & also results in "stuck" processes. So far I've tried on 8.2/8.3 i386 and amd64. The full implementation is planned to use fifos for input and output along with fd redirection but attempts using that have fared no better. Can anyone provide a secret-sauce recipe for netcat/fifo success? Thanks, Wayne
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1346699481.13805.42.camel>