I'd like to open a simple file socket that can run in background like:

nc -l -k -m 10 -U my_socket -c cat &

so other processes can connect into it with nc -U my_socket -c read.

After this happen I want to count how many clients are currently connected to the socket, but at first I would like to ensure it is already opened before I start checking anything. I believe that coproc can be used properly for this purpose, unfortunately I have got no idea how to use it.

Could I get any tips how to solve this one?

  • What is -m flag? – coffeMug Jun 15 '16 at 18:24
  • @coffeMug maximum simultaneous connections. However it is only available in some implementations of netcat program (it's called ncat I believe). Default Ubuntu one does not have this, I had to install nmap for this purpose. – mtszkw Jun 15 '16 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.