Search code examples
linuxtcpnetcat

How to listen for multiple tcp connection using nc


How to create a TCP connection using nc which listens to multiple hosts?

nc -l -p 12345

Solution

  • Simultaneous connections are not possible with netcat. You should use something like ucspi-tcp's tcpserver tool or leverage xinetd since you're on Linux.

    See: https://superuser.com/questions/232747/netcat-as-a-multithread-server

    Consecutive connections could be handled through a shell script that restarts netcat after it finishes.