0

At work ( BSD nc version ) and on many internet examples ncat can listen to udp and be used with the following options :

  1. -k which allows multiple connections
  2. -w 0 which terminates the current connection when the client disconnects

At home I have the following

Command : Ncat: Version 7.60 ( https://nmap.org/ncat )
OS : Fedora 27

I am unable to use either -k or -w 0.

ncat -klu localhost 8000
Ncat: UDP mode does not support the -k or --keep-open options, except with --exec or --sh-exec. QUITTING.

nc -luw 0 localhost 8000
Ncat: Invalid -w timeout (must be greater than 0). QUITTING.

How do I do the keep alive and the instant timeout in my version of ncat? ( man page does not help )

Thanks

  • What's your question? Why don't you do check with the package manager on your system at work what version (and flavor) your ncat is? – Tomáš Pospíšek Jun 16 '18 at 14:47
  • It seems there has been considerable change in 7.6. How can I achieve the equivalent of using -k and -w 0 in my version? – Pilsudski Jun 16 '18 at 20:18
0

The error messages give you a pretty good idea of what needs to be done


ncat -klu localhost 8000
Ncat: UDP mode does not support the -k or --keep-open options, except with --exec or --sh-exec. QUITTING.

You have to provide a listening program for ncat to use. To have the input just echo back to the sender, you can do this:

ncat -e /bin/cat -klu localhost 8000

nc -luw 0 localhost 8000
Ncat: Invalid -w timeout (must be greater than 0). QUITTING.

nc doesn't support a zero wait time, so just use something else

nc -luw 1 localhost 8000

Unfortunately, nc does not support subsecond wait times, but you can use the more feature rich ncat instead:

ncat -lu -w 100ms localhost 8000

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.