Um, depends. (: If your server does non-parsed headers by giving you a pipe to write to and then notices that the client has closed the socket, you might be able to detect the action that the server takes after noticing. If it closes its handle to the pipe, then your next write to the pipe will generate a SIGPIPE which you can catch. If the server kills you, then you can catch that.

If the server does non-parsed headers by passing the socket directly to you as your STDOUT, then when the client closes the socket your next write to the socket will fail (print actually has a return value, even though it is usually ignored). If you aren't constantly writing to STDOUT, then you can use select() to detect when the socket gets closed by the client.

        - tye (but my friends call me "Tye")

In reply to (tye)Re: Checking for NPH client connection by tye
in thread Checking for NPH client connection by ryddler

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.