Thread: TCP TIME_WAIT state

  1. #1
    Registered User Engineer's Avatar
    Join Date
    Oct 2001

    TCP TIME_WAIT state

    Just though to share this with those of you who are into network programming:

    According to every network programming resource I have seen TIME_WAIT state after closing a TCP connection is a normal thing. It should remain there up to 2MSL and then it dissappears. I have written and seen a lot of TCP servers and clients that demonstrate this perfectly. Most of the time TCP acts according to specification, and depending on which side made the active close, the same side would remain in the TIME_WAIT state preventing the reincarnation of this socket.

    The TIME_WAIT state can be avoided if the connection is reset after one side initiated an active close. In this case the connection dissappears completely from the netstat table. This is what I wanted to achieve and I actually did this in my latest server.

    But after doing some research on the Internet and reading some Stevens books and some RFCs I discovered that immediate termination of the TIME_WAIT state can lead to problems with TCP especially using TCP connections.

    I was thinking about this and I really can't think of any problems that might arise from doing this, especially if my own internal data is enumerated and sequential (but it could be either synchronous or asynchronous).

    Any help will be greatly appreciated...

    Merry Christmas and Happy New Year, Everyone!!!
    1 rule of the Samurai Code: if you have nothing to say, don't say anything at all!

  2. #2
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    hmm...what problems did it say it causes? I can't really think of any, but you know as well as I do that when you're programming something, the least likely bug always becomes the most likely.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Finite State Machine
    By ArlexBee-871RBO in forum C++ Programming
    Replies: 8
    Last Post: 07-14-2008, 11:59 AM
  2. Grammar to FSA to C code (Newbie)
    By aybe in forum C Programming
    Replies: 4
    Last Post: 02-29-2008, 02:10 PM
  3. Class Design question.
    By g4j31a5 in forum C++ Programming
    Replies: 10
    Last Post: 11-08-2006, 10:28 PM
  4. input/switch statement issues
    By peanut in forum C Programming
    Replies: 5
    Last Post: 10-27-2006, 02:58 PM
  5. NAQ: Everything you never wanted to know about CPP
    By evildave in forum C Programming
    Replies: 21
    Last Post: 12-12-2005, 10:56 AM