← BYTES
Unix IPC·Starter·Ref: 15.1.33

In plain terms, what is the basic difference between TIME_WAIT and CLOSE_WAIT?

Have a question about this video? Mention reference 15.1.33 when you contact us.

   TIME_WAIT:   I closed first.  Clears itself after a timer.
   CLOSE_WAIT:  the PEER closed first.  Waits on MY code to close() too.
a.TIME_WAIT happens to the side that ACTIVELY closed the connection and clears itself automatically after a timer; CLOSE_WAIT happens to the side that PASSIVELY received a close and only clears when its own application calls close()
b.They are two different names for the exact same state
c.TIME_WAIT only happens on UDP, CLOSE_WAIT only happens on TCP
d.CLOSE_WAIT always lasts longer than TIME_WAIT by design
The key practical difference: TIME_WAIT is self-clearing (a kernel timer eventually releases it, no app action needed) and belongs to the active closer. CLOSE_WAIT has no such timer at all -- it belongs to the passive closer, and persists indefinitely until that side's own application code calls close().

Find this on YouTube & Instagram

Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:

#BYTES#BYTES15133#UnixIPC