I faced with some strange nc behavior. It works well with TCP when on one host I do:

nc -tlp 31337

and on the other one:

nc 31337  

So there can be some data exchange.
But when I do:

nc -ulp 31337


nc 31337

fails with:

(UNKNOWN) [] 31337 (?) : Connection refused

But there are no iptables rules on both listening and connecting sides.

P.S. nc version is v1.10-41

  • 2
    Check the manual for the meaning of -t. Maybe you though -t means TCP. I don't know all nc implementations but most likely TCP is specified by lack of -u. – Kamil Maciorowski Dec 9 '19 at 12:37

The connecting nc needs -u as well. Otherwise it tries TCP and finds no listening process for this TCP port. The last command should be:

nc -u 31337

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.