1
1
I need to test a TCP server by connecting with netcat as a client sending a stream from /dev/random and at the same time pipe the output to /dev/null.
Receiving:
nc 127.0.0.1 3000 > /dev/null
Sending:
cat /dev/random | nc 127.0.0.1 3000
How can I do both at same time?
I can only connect one client and I need to pipe output to /dev/null for fast consumption of the output (~50MB/s).
No, this would not work. I need to send to stdin of netcat and pipe stdout of same netcat process to /dev/null. – JeffV – 2012-07-19T12:20:05.693
netcat
can open only 1 network connection. For a client/server model, you need 2 processes. See the example on the manpage at http://linux.die.net/man/1/nc – ott-- – 2012-07-19T13:13:55.497Not looking for more than one connection. In this case server by design is restricted to only one client at a time. Since, the TCP connection is bidirectional, and I am trying to send random bytes to the server while consuming everything it sends to the client as fast as possible. – JeffV – 2012-07-19T19:00:32.167
Ah, you're looking for the
echo
service. Check your /etc/inetd.conf or xinetd.conf,echo
is usually disabled.chargen
is also a nice thing to play with. – ott-- – 2012-07-19T19:56:16.363