netcat as a multithread server

Posted by etuardu on Super User See other posts from Super User or by etuardu
Published on 2011-01-13T15:04:22Z Indexed on 2011/01/13 15:55 UTC
Read the original article Hit count: 286

Hello,
I use netcat to run a simple server like this:

while true; do nc -l -p 2468 -e ./my_exe; done

This way, anyone is able to connect to my host on port 2468 and talk with "my_exe".
Unfortunately, if someone else wants to connect during an open session, it would get a "Connection refused" error, because netcat is no longer in listening until the next "while" loop.

Is there a way to make netcat behave like a multithread server, i.e. always in listening for incoming connections? If not, are there some workarounds for this?

Thank you all!

© Super User or respective owner

Related posts about server

Related posts about netcat