In TCP communications a TCP client program should always end the connection with a EOF packet; basically a TCP packet with the RST (reset) flag set in the TCP headers and no data content. I did some experiments and found that even if I killed the client hard (w/ a "kill -9" or equivalent) that I still got the RST packet on the server. The RST packet must have been sent by the program as it was dying or by the OS when it discovered the abandoned sockethandle. Now what if the client program dies very hard (like if the machine it is on loses power) or if network connectivity between the client and your server is lost. In those cases no RST packet would ever be reveived by your server so it would never realize that the connection was closed. In that case you would only realize that the connection was dead when a timeout occurred on the connection or by the SIGPIPE signal mentioned above. No SIGPIPE or other signal is sent when a client closes a connection normally.

In reply to Re: trap signal? by lhoward
in thread trap signal? by Delfer

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.