Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
I am looking for edge condition precedences. Syswrite to a closed socket(closed at remote end) results in Perl termination, with or without eval. Are there edge conditions that allow this?

This code (without the eval and test blocks) can be seen on the botton of page 209 of Advance Perl Programming, #1. The MSG module.

while (@$rq) { my $msg = $rq->[0]; my $bytes_to_write = length($msg) - $offset; my $bytes_written = 0; while ($bytes_to_write) { #write the prefixed length print "_send: syswrite to sock prefix length\n"; eval { $bytes_written = syswrite ($sock, $msg, $bytes_to_write, $offset); }; if ($@){ print "_send: syswrite to sock error <$@>\n"; } print "_send: syswrite to sock returned <$bytes_written>\n"; if (!defined($bytes_written)) { if (_err_will_block($!)) { # Should happen only in deferred mode. Record how # much we have already sent. $conn->{send_offset} = $offset; # Event handler should already be set, so we will # be called back eventually, and will resume sending return 1; ...
This is Perl 5.14.
The consistant result, running in foreground, when the server is shutdown, and a client send is attempted is:
checkRealTTY:: starting UID=<UID> rIP=<> Acct=<root> _send entered <Msg=HASH(0x29987c8)> flush=<1> _send: syswrite to sock prefix length root@kali:/usr/share/msg/bin#

It is always better to have seen your target for yourself, rather than depend upon someone else's description.


In reply to Sockets, eval , and DIE by Wiggins

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others avoiding work at the Monastery: (6)
    As of 2014-12-26 04:40 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (165 votes), past polls