Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 2 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.)

share|improve this answer
    
So to sum up: port 0 means ANY port? –  rzr00 Feb 6 '12 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 '12 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 '12 at 9:56
1  
… although a connect() on a UDP/IP socket will change this behaviour. –  JdeBP Feb 6 '12 at 13:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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