title: How to fix WSAECONNABORTED error?
body: <p>I have a C/S application. The client usually send a large amount of data to server using TCP protocol. It works well in LAN environment(10MB/s), but network errors happen when I migrate it to WAN environment(200KB/s).</p>
  
  <p>As I track the bug, I find that <code>send()</code> in client returns -1 and <code>WSAGetLastError()</code> returns <code>WSAECONNABORTED</code> at first; And several seconds later, <code>recv()</code> in server also returns -1 and <code>errno</code> is <code>ECONNRESET</code>.</p>
  
  <p>After consulting documents, I have a basic understanding of <code>WSAECONNABORTED</code> and <code>ECONNRESET</code>.
  I think the former is resulted from the bad network: TCP closes the socket after several retransmission failures. And the latter is resulted from the unexpected close operation in client.</p>
  
  <p>I wonder how to handle this kind of error. Reconnect immediately? Or any socket options can help?</p>