Wiggins has asked for the wisdom of the Perl Monks concerning the following question:
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.
This is Perl 5.14.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; ...
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sockets, eval , and DIE
by mr_mischief (Monsignor) on Apr 17, 2014 at 16:56 UTC | |
by Wiggins (Hermit) on Apr 17, 2014 at 17:45 UTC | |
by andal (Hermit) on Apr 22, 2014 at 06:27 UTC |