What is the meaning of port 0 in netstat -an output in Windows? I'm asking about socket in Foreign address column:

0.0.0.0:0

I know that 0.0.0.0 address means, that host is listening on all interfaces, but what is the function of port zero?

link|improve this question
feedback

1 Answer

up vote 1 down vote accepted

If you see this as the "Foreign" address, the meaning is slightly different – it's not about the interface; that would be the "Local" address.

All zeros in the "Foreign" column just mean that there is no remote address yet. The line represents a listening socket, which will accept connections from any address, any port. Those connections would be displayed as separate lines.

(From what I remember, in some early systems it used to be possible to create TCP sockets that would only accept connections from a specific host, a specific port, or both.)

link|improve this answer
So to sum up: port 0 means ANY port? – rzr00 Feb 6 at 8:03
Yes. In the Foreign address, 0:0 means any remote host, any remote port. (Just to remind: this column is not about local interfaces.) – grawity Feb 6 at 8:34
1  
@RZR A TCP listening socket or any UDP socket will basically always be listening for connections or datagrams from any port. – David Schwartz Feb 6 at 9:56
1  
… although a connect() on a UDP/IP socket will change this behaviour. – JdeBP Feb 6 at 13:10
feedback

Your Answer

 
or
required, but never shown

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