How to listen for multiple tcp connection using nc
I recommend socat
as nc
alternative.
For OP's problem, socat - TCP-LISTEN:12345,fork,reuseaddr
can do the job.
ncat
can do it.
E.g. ncat --broker --listen -p 12345
will distribute all incoming messages to all other clients (think of it as a hub).
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.