nc(1) reports a successful a connection to any port when using UDP. Even if the port is not opened. Am I misunderstanding something or is this really a bug?
Code:
# sockstat -4l | grep 123
# nc -zu localhost 123
Connection to localhost 123 port [udp/ntp] succeeded!
UDP is a stateless transport protocol, you send data and hope for a reply. In this case nc(1) just reports that it was able to send UDP packet(s) with destination address localhost and port 123 but since UDP is stateless there's no way for it to know if they were ever received at the destination. With TCP there's always the three way handshake that is defined in the standard that can be used to reveal if a port is open or not.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.