linux nc (netcat) UDP Connection refused

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 14.0.0.1 31337 

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

nc -ulp 31337

then

nc 14.0.0.1 31337

fails with:

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

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

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

1

1 Answer

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 14.0.0.1 31337
0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like