When I do netstat -a on my Windows machine, I get a listing of the ports with one of the four states:


What do CLOSE_WAIT and TIME_WAIT mean/indicate?

up vote 159 down vote accepted

Due to the way TCP/IP works, connections can not be closed immediately. Packets may arrive out of order or be retransmitted after the connection has been closed. CLOSE_WAIT indicates that the remote endpoint (other side of the connection) has closed the connection. TIME_WAIT indicates that local endpoint (this side) has closed the connection. The connection is being kept around so that any delayed packets can be matched to the connection and handled appropriately. The connections will be removed when they time out within four minutes. See http://en.wikipedia.org/wiki/Transmission_Control_Protocol for more details.

  • 6
    The weasel words "other side" and "this side" are confusing. Can we have this rewritten (correctly) with "source" and "destination" instead? – ADTC Mar 12 '14 at 8:11
  • 65
    @ADTC No, because that wouldn't make sense -- TCP is full-duplex, either side can be the source or destination. The correct words would be "local endpoint" and "remote endpoint". – Jonathon Reinhart Apr 28 '14 at 1:03
  • 3
    @JonathonReinhart, It's just "local" and "remote". "endpoint" is redundant. – Pacerier Jan 23 '16 at 3:29
  • 7
    @Pacerier Except "endpoint" is a noun and "local" isn't. – Jonathon Reinhart Jan 23 '16 at 5:16
  • 3
    @JonathonReinhart, Both "local" and "remote" can be nouns. That aside, I found another discussion here which states it's "local / peer" instead of "local / remote": stackoverflow.com/questions/14388706/… – Pacerier Jan 23 '16 at 18:08

Basically the "WAIT" states mean that one side closed the connection but the final confirmation of the close is pending.

See e.g. this diagram of TCP states for details:


  • 11
    This accurately describes CLOSE_WAIT but not TIME_WAIT. TIME_WAIT indicates that the local application closed the connection, and the other side acknowledged and sent a FIN of its own. We're now waiting for any stray duplicate packets that may upset a new user of the same port. – Chris Smowton Apr 10 '14 at 12:11
  • 1
    @ChrisSmowton, So who is using the right terminology? The diagram or netstat? (cf.) – Pacerier Jan 23 '16 at 3:38
  • @Pacerier I think they match -- where do you think they disagree? – Chris Smowton Feb 1 '16 at 16:42
  • @ChrisSmowton So this means next port owner may get extra bytes and that can break the response if we set TIME_WAIT = 0 ? – MonsterMMORPG Mar 20 '17 at 16:00
  • Possible but very unlikely, as the sequence numbers would need to match for the application to see the rogue packet spliced into the stream, or the receiver would need to buffer the apparently out of order packet until the right sequence number came around. I don't know enough about practical implementations to tell you whether the latter is done in practice. – Chris Smowton Mar 20 '17 at 21:12

TIME_WAIT represents waiting for enough time to be sure that remote TCP received the ACK of its FIN request. See en.wikipedia.org/wiki/Transmission_Control_Protocol (and also RFC 793)

  • 1
    What does this add to the information provided by the existing answers? – fixer1234 May 20 '16 at 16:59
  • Adds a reference to RFC 793 – Denio Mariz Oct 4 '17 at 14:42

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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