-4

I have read other threads regarding sockets in TIME_WAIT, but I am clearly still missing something.

Below is a few lines from a "netstat -an". How could it get into this situation? If I understood the descriptions I found, we should not have more than one instance of the socket 63444 ... but after the one listed as "LISTEN" there are about 50 individual socket connections with one end at 63444, all in "TIME_WAIT". How could this happen, and how can I fix it?

tcp        0      0 0.0.0.0:63444           0.0.0.0:*               LISTEN      
tcp        0      0 169.254.7.228:63444     169.254.66.84:35391     TIME_WAIT   
tcp        0      0 169.254.7.228:63444     169.254.66.84:35283     TIME_WAIT   
tcp        0      0 169.254.7.228:63444     169.254.66.84:35352     TIME_WAIT   
tcp        0      0 169.254.7.228:63444     169.254.66.84:35431     TIME_WAIT
Jenny D
  • 27,780
  • 21
  • 75
  • 114
  • This is normal TCP behavior. You have one entry per connection. As you can see, the port on the right is different for every one of them. They are different TCP connections. –  Aug 19 '15 at 22:33
  • 1
    For the same reasons as when you [asked this on SO](http://stackoverflow.com/questions/32106760/why-is-the-same-socket-in-time-wait-many-times) – Eric Renouf Aug 21 '15 at 15:41

1 Answers1

4

TCP connections are not identified by just the local port number. They are identified by the tuple consisting of local IP address, local port number, remote IP address, and remote port number.

Since the remote port number differs, they are different connections.

The socket API has one socket per connection plus one listening socket for accepting incoming connections.

kasperd
  • 30,455
  • 17
  • 76
  • 124