title: Linux TCP socket crash
body: <p>I write network application which communicates via Linux TCP socket. Recently I've noticed send system call crashing my application. It works fine when both peers are up (I'm testing crash recovery now). But when one peer is down second crashes executing this piece of code. </p>
  
  <pre><code>    fprintf(stderr, "out_tcp %d\n", out_tcp);
      if(send(out_tcp, &amp;packet, sizeof(packet), 0) == -1) 
          fprintf(stderr, "send TCP error");
      fprintf(stderr, "after send");
  </code></pre>
  
  <p>Socket is already prepared and connected and was executed several times before second peer went down. I've expected this code returning -1 value, but it produces on output only "out_tcp 11" then application exits. No error message, no returned value from send. I run it under Valgrind, it says application exits normally - no error/warning message. </p>
  
  <p>Does anyone has any idea how to debug it? Tools to use? I'm pretty stuck with this as I get no informations. </p>
  
  <p>Thanks in advance
  Harnen</p>