title: Tcp connections hang on CLOSE_WAIT status
body: <p>Client close the socket first, when there is not much data from server, tcp connection shutdown is okay like:</p>
  
  <pre><code>FIN --&gt;
     &lt;-- ACK
     &lt;-- FIN, ACK
  ACK --&gt;
  </code></pre>
  
  <p>When the server is busying sending data:</p>
  
  <pre><code>FIN --&gt;
      &lt;-- ACK,PSH
  RST --&gt;
  </code></pre>
  
  <p>And the server connection comes to CLOSE_WAIT state and hang on there for a long time.</p>
  
  <p>What's the problem here? client related or server related? This happens on Redhat5 for local sockets.</p>
  
  <p>This <a href="http://blog.netherlabs.nl/articles/2009/01/18/the-ultimate-so_linger-page-or-why-is-my-tcp-not-reliable" rel="nofollow noreferrer">article</a> talk about why "RST" is sent, but I do not know why the server connection stuck on CLOSE_WAIT, and do not send a FIN out.</p>
  
  <p>[EDIT]I ignored the most important information, this happens on qemu's slirp network emulation. It seems to be a problem of slirp bug for dealing with close connection.</p>