title: Why should TCP socket be closed by server first?
body: <p>I am wondering whether the connection should be closed by the client or the server in TCP.</p>
  <p>RFC6455 says the following</p>
  <blockquote>
  <p>The underlying TCP connection, in most normal cases, SHOULD be closed
  first by the server, so that it holds the TIME_WAIT state and not the
  client (as this would prevent it from re-opening the connection for 2
  maximum segment lifetimes (2MSL), while there is no corresponding
  server impact as a TIME_WAIT connection is immediately reopened upon
  a new SYN with a higher seq number).</p>
  </blockquote>
  <p>Why should the client side avoid the TIME_WAIT state?
  Is it because the server side can reopen with new SYN, while the client side can't, which leads to local port exhaustion?</p>