4

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?

1

1 Answer 1

3

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.)

4
  • So to sum up: port 0 means ANY port? Commented Feb 6, 2012 at 8:03
  • 1
    Yes. In the Foreign address, 0:0 means any remote host, any remote port. (Just to remind: this column is not about local interfaces.) Commented Feb 6, 2012 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. Commented Feb 6, 2012 at 9:56
  • 1
    … although a connect() on a UDP/IP socket will change this behaviour.
    – JdeBP
    Commented Feb 6, 2012 at 13:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .