title: When send()/recv() fails. Where does the socket stands?
body: <p>Suppose I have a socket which I have created by the <code>socket()</code> system call. After that I did a <code>connect()</code> and started sending and receiving data.</p>
  
  <p>Similarly, on the other side,  a socket was created with the <code>socket()</code> system call, and then <code>bind()</code>, <code>listen()</code> and <code>accept()</code> were called. Then this side also started communicating.</p>
  
  <p>Now lets suppose one of the <code>send()</code> (and accordingly <code>recv()</code> on the other side) fails.</p>
  
  <p>What I want to where would that socket stand after the fail?</p>
  
  <p>To communicate again, should I create the socket again and do <code>connect()</code> (<code>bind()</code>, <code>listen()</code> and <code>accept()</code> on the other side) or I can try <code>send()</code> and <code>recv()</code> again? And additionally, what is the best thing to be done in such a scenario?</p>
  
  <p><strong>NOTE:</strong> We do not know what is the reason for the <code>send()</code>/<code>recv()</code> to fail. It can be anything from a physical wire break to the other side refusing (maybe using iptables).</p>