POE-Component-Client-Ping-1.171/000755 000765 000024 00000000000 11725554533 016341 5ustar00trocstaff000000 000000 POE-Component-Client-Ping-1.171/CHANGES000644 000765 000024 00000003337 11725554534 017343 0ustar00trocstaff000000 000000 ================================ 2012-03-06 22:42:14 -0500 v1_171 ================================ commit ef46396c4d15e9a3a3324445f6a7b7481f212f3c Author: gregor herrmann Date: Tue Mar 6 22:38:27 2012 -0500 [rt.cpan.org 74189] Merge Debian patch to skip a regression test unless root. ================================ 2012-01-05 17:13:11 -0500 v1_170 ================================ commit 0a82763c0680061ad7198ad5674501e4c697eda0 Author: Rocco Caputo Date: Thu Jan 5 17:13:11 2012 -0500 Bump version for release. commit ae5ac39a7e28ee679260570b023a0cd8d5257cba Author: Rocco Caputo Date: Thu Jan 5 15:56:50 2012 -0500 Resolve Viliam Pucik's rt.cpan.org ticket 72055. Correct edge-case behavior when making duplicate requests from a single session. commit 951d3a5a614011e99c4f584a989f07a2f94bdc41 Author: Rocco Caputo Date: Thu Jan 5 09:02:45 2012 -0500 Fix indent damage enabled by a bad vim modeline. No significant changes. commit faaf4c082383590fbd8879f82a7540daaeff91a9 Author: Rocco Caputo Date: Thu Jan 5 08:35:37 2012 -0500 Add a test case for rt.cpan.org 72055, opened by Viliam Pucik. commit 27c7a7dad945265b645d3eaef20016cad7414990 Author: Rocco Caputo Date: Thu Jan 5 00:50:13 2012 -0500 Reduce complexity in the retry code. Also apply a fix for rt.cpan.org 68702, reported and fixed by Iulia Bublea. commit 798349d68bbdbd4f4b00af21f0c1ac5366fb891e Author: Rocco Caputo Date: Wed Jan 4 18:10:23 2012 -0500 Simplify existing code. ============== End of Excerpt ============== POE-Component-Client-Ping-1.171/lib/000755 000765 000024 00000000000 11725554533 017107 5ustar00trocstaff000000 000000 POE-Component-Client-Ping-1.171/Makefile.PL000644 000765 000024 00000001477 11253023120 020277 0ustar00trocstaff000000 000000 #!/usr/bin/perl use ExtUtils::MakeMaker; # Touch CHANGES so it exists. open(CHANGES, ">>CHANGES") and close CHANGES; WriteMakefile( NAME => 'POE::Component::Client::Ping', AUTHOR => 'Rocco Caputo ', ABSTRACT => 'POE component for non-blocking/concurrent ICMP ping.', LICENSE => 'perl', VERSION_FROM => 'lib/POE/Component/Client/Ping.pm', META_ADD => { resources => { license => 'http://dev.perl.org/licenses/', repository => 'http://github.com/rcaputo/poe-component-client-ping/' }, }, PREREQ_PM => { 'POE' => 1.007, 'Time::HiRes' => 1.20, }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', PREOP => ( 'git-log.pl | tee ./$(DISTNAME)-$(VERSION)/CHANGES > ./CHANGES' ), }, ); POE-Component-Client-Ping-1.171/MANIFEST000644 000765 000024 00000000527 11725554534 017477 0ustar00trocstaff000000 000000 CHANGES MANIFEST Makefile.PL lib/POE/Component/Client/Ping.pm README t/00_info.t t/01_ping.t t/02_arbitrary_data.t t/03_provided_socket.t t/04_timeout_retry.t t/zz_rt_72055.t META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) POE-Component-Client-Ping-1.171/META.json000644 000765 000024 00000002163 11725554533 017764 0ustar00trocstaff000000 000000 { "abstract" : "POE component for non-blocking/concurrent ICMP ping.", "author" : [ "Rocco Caputo " ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.112150", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "POE-Component-Client-Ping", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : 0 } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : 0 } }, "runtime" : { "requires" : { "POE" : "1.007", "Time::HiRes" : "1.2" } } }, "release_status" : "stable", "resources" : { "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "url" : "http://github.com/rcaputo/poe-component-client-ping/" } }, "version" : "1.171" } POE-Component-Client-Ping-1.171/META.yml000644 000765 000024 00000001224 11725554533 017611 0ustar00trocstaff000000 000000 --- abstract: 'POE component for non-blocking/concurrent ICMP ping.' author: - 'Rocco Caputo ' build_requires: ExtUtils::MakeMaker: 0 configure_requires: ExtUtils::MakeMaker: 0 dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.112150' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: POE-Component-Client-Ping no_index: directory: - t - inc requires: POE: 1.007 Time::HiRes: 1.2 resources: license: http://dev.perl.org/licenses/ repository: http://github.com/rcaputo/poe-component-client-ping/ version: 1.171 POE-Component-Client-Ping-1.171/README000644 000765 000024 00000003556 11253022662 017217 0ustar00trocstaff000000 000000 -------- Abstract -------- POE::Component::Client::Ping is an asynchronous, event driven client for ICMP ping. It accepts events containing the specifics of ICMP ping requests, and it returns events carrying the results of those pings. ------------ Requirements ------------ This module requires POE. It also requires root privilege, or your operating system's equivalent, so that it can open a socket for ICMP ping. Knowing what this means, how to achieve it, and the potential hazards of doing so are left as exercises for the reader. ------------------ Basic Installation ------------------ POE::Component::Client::Ping may be installed through the CPAN shell in the usual CPAN shell manner. This typically is: $ perl -MCPAN -e 'intstall POE::Component::Client::Ping' You can also read this README from the CPAN shell: $ perl -MCPAN -e shell cpan> readme POE::Component::Client::Ping And you can install the component from the CPAN prompt as well: cpan> install POE::Component::Client::Ping ------------------- Manual Installation ------------------- POE::Component::Client::Ping can also be installed manually. or a similarly named directory at your favorite CPAN mirror should hold the latest version. Downloading and unpacking the distribution are left as exercises for the reader. To build and test it: perl Makefile.PL make test The test program, t/01_ping.t, makes an excellent sample program. In fact, it was adapted from the sample program used to debug this component. If you would like to see more details about the test's operation, edit t/01_ping.t and set the DEBUG constant to any value Perl considers "true". When you're ready to install the component: make install It should now be ready to use. Thanks for reading! -- Rocco Caputo / troc@netrus.net / poe.perl.org / poe.sourceforge.net POE-Component-Client-Ping-1.171/t/000755 000765 000024 00000000000 11725554533 016604 5ustar00trocstaff000000 000000 POE-Component-Client-Ping-1.171/t/00_info.t000644 000765 000024 00000000422 11313245543 020210 0ustar00trocstaff000000 000000 #!/usr/bin/perl # vim: ts=2 sw=2 filetype=perl expandtab use warnings; use strict; use Test::More tests => 2; use_ok('POE'); use_ok('POE::Component::Client::Ping'); # idea from Test::Harness, thanks! diag( "Testing POE $POE::VERSION, ", "Perl $], ", "$^X on $^O" ); POE-Component-Client-Ping-1.171/t/01_ping.t000644 000765 000024 00000007464 11253007075 020227 0ustar00trocstaff000000 000000 #!/usr/bin/perl -w # vim: filetype=perl use strict; BEGIN { $| = 1; if ($> and ($^O ne 'VMS')) { print "1..0 # skipped: ICMP ping requires root privilege\n"; exit 0; } }; sub POE::Kernel::ASSERT_DEFAULT () { 1 } use POE qw(Component::Client::Ping); use Test::More tests => 2; sub PING_TIMEOUT () { 5 }; # seconds between pings sub PING_COUNT () { 1 }; # ping repetitions sub DEBUG () { 0 }; # display more information #------------------------------------------------------------------------------ # A bunch of addresses to ping. my @addresses = qw( 127.0.0.1 209.34.66.60 216.127.84.31 216.132.181.250 216.132.181.251 64.106.159.160 64.127.105.9 64.235.246.143 64.38.255.150 66.207.163.5 66.33.204.143 ); #------------------------------------------------------------------------------ # This session uses the ping component to resolve things. sub client_start { my ($kernel, $session, $heap) = @_[KERNEL, SESSION, HEAP]; DEBUG and warn($session->ID, ": starting pinger client session...\n"); # Set up recording. $heap->{requests} = 0; $heap->{answers} = 0; $heap->{dones} = 0; $heap->{ping_counts} = { }; # Start pinging. foreach my $address (@addresses) { $heap->{ping_counts}->{$address} = 0; $kernel->call( $session, ping => $address ); } } sub client_send_ping { my ($kernel, $session, $heap, $address) = @_[KERNEL, SESSION, HEAP, ARG0]; DEBUG and warn( $session->ID, ": pinging $address...\n" ); $heap->{requests}++; $heap->{ping_counts}->{$address}++; $kernel->post( 'pinger', # Post the request to the 'pinger'. 'ping', # Ask it to 'ping' an address. 'pong', # Have it post an answer to my 'pong' state. $address, # This is the address we want it to ping. PING_TIMEOUT # This is the optional time to wait. ); } sub client_got_pong { my ($kernel, $session, $heap, $request_packet, $response_packet) = @_[KERNEL, SESSION, HEAP, ARG0, ARG1]; my ($request_address, $request_timeout, $request_time) = @{$request_packet}; my ( $response_address, $roundtrip_time, $reply_time, $reply_ttl ) = @{$response_packet}; if (defined $response_address) { DEBUG and warn( sprintf( "%d: ping to %-15.15s at %10d. " . "pong from %-15.15s in %6.3f s (ttl %3d)\n", $session->ID, $request_address, $request_time, $response_address, $roundtrip_time, $reply_ttl, ) ); $heap->{answers}++ if $roundtrip_time <= $request_timeout; $heap->{bad_ttl}++ if ( $reply_ttl !~ /^\d+$/ or $reply_ttl < 0 or $reply_ttl > 255 ); } else { DEBUG and warn( $session->ID, ": time's up for $request_address...\n" ); $kernel->yield(ping => $request_address) if ( $heap->{ping_counts}->{$request_address} < PING_COUNT ); $heap->{dones}++; } } sub client_stop { my ($session, $heap) = @_[SESSION, HEAP]; DEBUG and warn( $session->ID, ": pinger client session stopped...\n" ); ok( ( $heap->{requests} == $heap->{dones} && $heap->{answers} && !$heap->{bad_ttl} ), "pinger client session got responses" ); } #------------------------------------------------------------------------------ # Create a pinger component. POE::Component::Client::Ping->spawn( Alias => 'pinger', # This is the name it'll be known by. Timeout => PING_TIMEOUT, # This is how long it waits for echo replies. ); # Create two sessions that will use the pinger. This tests # concurrency against the same addresses. for (my $session_index = 0; $session_index < 2; $session_index++) { POE::Session->create( inline_states => { _start => \&client_start, _stop => \&client_stop, pong => \&client_got_pong, ping => \&client_send_ping, } ); } # Run it all until done. POE::Kernel->run(); exit; POE-Component-Client-Ping-1.171/t/02_arbitrary_data.t000644 000765 000024 00000001531 11253007102 022237 0ustar00trocstaff000000 000000 #!/usr/bin/perl # vim: filetype=perl use strict; use warnings; BEGIN { $| = 1; if ($> and ($^O ne 'VMS')) { print "1..0 # skipped: ICMP ping requires root privilege\n"; exit 0; } }; sub POE::Kernel::ASSERT_DEFAULT () { 1 } use POE qw(Component::Client::Ping); use Test::More tests => 1; $|=1; POE::Component::Client::Ping->spawn( Alias => 'pinger', OneReply => 1 ); POE::Session->create( package_states => [ 'main' => [ qw(_start pong) ], ], options => { trace => 0 }, ); POE::Kernel->run(); exit 0; sub _start { my ($kernel,$heap) = @_[KERNEL,HEAP]; $kernel->post( 'pinger', 'ping', [ 'pong', 'foo' ], "poe.perl.org" ); } sub pong { my ($heap, $request, $response) = @_[HEAP, ARG0, ARG1]; $request->[3] = "(undef)" unless defined $request->[3]; ok($request->[3] eq "foo", "got arbitrary data: $request->[3]"); } POE-Component-Client-Ping-1.171/t/03_provided_socket.t000644 000765 000024 00000010210 11253007107 022433 0ustar00trocstaff000000 000000 #!/usr/bin/perl -w # vim: filetype=perl ts=2 sw=2 expandtab use strict; BEGIN { $| = 1; if ($> and ($^O ne 'VMS')) { print "1..0 # skipped: ICMP ping requires root privilege\n"; exit 0; } }; sub POE::Kernel::ASSERT_DEFAULT () { 1 } use POE qw(Component::Client::Ping); use Test::More tests => 2; sub PING_TIMEOUT () { 5 }; # seconds between pings sub PING_COUNT () { 1 }; # ping repetitions sub DEBUG () { 0 }; # display more information #------------------------------------------------------------------------------ # A bunch of addresses to ping. my @addresses = qw( 127.0.0.1 209.34.66.60 216.127.84.31 216.132.181.250 216.132.181.251 64.106.159.160 64.127.105.9 64.235.246.143 64.38.255.150 66.207.163.5 66.33.204.143 ); #------------------------------------------------------------------------------ # This session uses the ping component to resolve things. sub client_start { my ($kernel, $session, $heap) = @_[KERNEL, SESSION, HEAP]; DEBUG and warn($session->ID, ": starting pinger client session...\n"); # Set up recording. $heap->{requests} = 0; $heap->{answers} = 0; $heap->{dones} = 0; $heap->{ping_counts} = { }; # Start pinging. foreach my $address (@addresses) { $heap->{ping_counts}->{$address} = 0; $kernel->call( $session, ping => $address ); } } sub client_send_ping { my ($kernel, $session, $heap, $address) = @_[KERNEL, SESSION, HEAP, ARG0]; DEBUG and warn( $session->ID, ": pinging $address...\n" ); $heap->{requests}++; $heap->{ping_counts}->{$address}++; $kernel->post( 'pinger', # Post the request to the 'pinger'. 'ping', # Ask it to 'ping' an address. 'pong', # Have it post an answer to my 'pong' state. $address, # This is the address we want it to ping. PING_TIMEOUT # This is the optional time to wait. ); } sub client_got_pong { my ($kernel, $session, $heap, $request_packet, $response_packet) = @_[KERNEL, SESSION, HEAP, ARG0, ARG1]; my ($request_address, $request_timeout, $request_time) = @{$request_packet}; my ( $response_address, $roundtrip_time, $reply_time, $reply_ttl ) = @{$response_packet}; if (defined $response_address) { DEBUG and warn( sprintf( "%d: ping to %-15.15s at %10d. " . "pong from %-15.15s in %6.3f s (ttl %3d)\n", $session->ID, $request_address, $request_time, $response_address, $roundtrip_time, $reply_ttl, ) ); $heap->{answers}++ if $roundtrip_time <= $request_timeout; $heap->{bad_ttl}++ if ( $reply_ttl !~ /^\d+$/ or $reply_ttl < 0 or $reply_ttl > 255 ); } else { DEBUG and warn( $session->ID, ": time's up for $request_address...\n" ); $kernel->yield(ping => $request_address) if ( $heap->{ping_counts}->{$request_address} < PING_COUNT ); $heap->{dones}++; } } sub client_stop { my ($session, $heap) = @_[SESSION, HEAP]; DEBUG and warn( $session->ID, ": pinger client session stopped...\n" ); ok( ( $heap->{requests} == $heap->{dones} && $heap->{answers} && !$heap->{bad_ttl} ), "pinger client session got responses" ); } #------------------------------------------------------------------------------ # Create a raw socket externally for the component to use. use Symbol qw(gensym); use Socket; my $protocol = (getprotobyname('icmp'))[2] or die "can't get icmp protocol by name: $!"; my $socket = gensym(); socket($socket, PF_INET, SOCK_RAW, $protocol) or die "can't create icmp socket: $!"; # Create a pinger component. POE::Component::Client::Ping->spawn( Alias => 'pinger', # This is the name it'll be known by. Timeout => PING_TIMEOUT, # This is how long it waits for echo replies. Socket => $socket, ); # Create two sessions that will use the pinger. This tests # concurrency against the same addresses. for (my $session_index = 0; $session_index < 2; $session_index++) { POE::Session->create( inline_states => { _start => \&client_start, _stop => \&client_stop, pong => \&client_got_pong, ping => \&client_send_ping, } ); } # Run it all until done. POE::Kernel->run(); exit; POE-Component-Client-Ping-1.171/t/04_timeout_retry.t000644 000765 000024 00000002505 11701326577 022210 0ustar00trocstaff000000 000000 #!/usr/bin/env perl # vim: ts=2 sw=2 expandtab # Tests whether timeout & retry artificially inflates the measured # round-trip time. Thanks to Ralph Schmitt, who reported this # problem. # Unfortunately this test relies upon the assumption that one can ping # 127.0.0.1. If you're on Mac OS X 10.5 for example, turn off # "stealth mode": # # System Preferences > Security > Firewall > Advanced > disable # "Enable stealth mode". use warnings; use strict; BEGIN { $| = 1; if ($> and ($^O ne 'VMS')) { print "1..0 # skipped: ICMP ping requires root privilege\n"; exit 0; } }; use POE qw(Component::Client::Ping); use Test::More tests => 2; POE::Component::Client::Ping->spawn( Alias => "pingthing", # defaults to "pinger" Retry => 2, # defaults to 1 attempt Parallelism => 64, # defaults to autodetect BufferSize => 65536, # defaults to undef ); POE::Session->create( inline_states => { _start => sub { $_[KERNEL]->post( pingthing => ping => pong => "127.0.0.1" ); }, pong => sub { my ($req, $rsp) = @_[ARG0, ARG1]; my $round_trip = $rsp->[1]; return unless defined $round_trip; # final timeout ok( $round_trip < 1, "response time not affected by timeout" ); }, }, ); POE::Kernel->run(); exit; POE-Component-Client-Ping-1.171/t/zz_rt_72055.t000644 000765 000024 00000003371 11725554204 020702 0ustar00trocstaff000000 000000 #!/usr/bin/env perl # vim: ts=2 sw=2 expandtab # Something in the request queue is discarding responses. # Reported in https://rt.cpan.org/Ticket/Display.html?id=72055 # # Losing a number of pings in the initial phase occurs when special # conditions are meet: # # * Pings are sent to the same host. # * Parallelism is 2 or more. # * Al least 2 ping events are created in a row (initial pings). # # The number of lost pings: min( Parallelism, initial pings ) - 1. # # Correct behavior is for 1 response to be received, and the remaining # N-1 requests to be forcibly timed out by subsequent duplicate # requests. use strict; use warnings; BEGIN { $| = 1; if ($> and ($^O ne 'VMS')) { print "1..0 # skipped: ICMP ping requires root privilege\n"; exit 0; } }; use Test::More tests => 2; use POE qw( Component::Client::Ping ); POE::Component::Client::Ping->spawn(Parallelism => 10, OneReply => 1); POE::Session->create( inline_states => { _start => sub { $_[HEAP]{got_answer} = $_[HEAP]{got_timeout} = $_[HEAP]{expected} = 0; # It's bad technique to send all the requets at once, but we're # doing this to expose a bug in the module's queuing logic. my @hosts = ( ('127.0.0.1') x 5 ); foreach (@hosts) { ++$_[HEAP]{expected}; $_[KERNEL]->post('pinger', 'ping', 'pong', $_); } }, _stop => sub { is( $_[HEAP]{got_timeout}, $_[HEAP]{expected} - 1, "got the right number of timeouts" ); is( $_[HEAP]{got_answer}, 1, "got the right number of answers" ); }, pong => sub { if (defined $_[ARG1]->[0]) { ++$_[HEAP]->{got_answer}; } else { ++$_[HEAP]->{got_timeout}; } }, }, ); POE::Kernel->run; POE-Component-Client-Ping-1.171/lib/POE/000755 000765 000024 00000000000 11725554533 017532 5ustar00trocstaff000000 000000 POE-Component-Client-Ping-1.171/lib/POE/Component/000755 000765 000024 00000000000 11725554533 021474 5ustar00trocstaff000000 000000 POE-Component-Client-Ping-1.171/lib/POE/Component/Client/000755 000765 000024 00000000000 11725554533 022712 5ustar00trocstaff000000 000000 POE-Component-Client-Ping-1.171/lib/POE/Component/Client/Ping.pm000644 000765 000024 00000075155 11725554404 024157 0ustar00trocstaff000000 000000 # License and documentation are after __END__. # vim: ts=2 sw=2 expandtab package POE::Component::Client::Ping; use warnings; use strict; use Exporter; use vars qw(@ISA @EXPORT_OK %EXPORT_TAGS); @ISA = qw(Exporter); @EXPORT_OK = qw( REQ_ADDRESS REQ_TIMEOUT REQ_TIME REQ_USER_ARGS RES_ADDRESS RES_ROUNDTRIP RES_TIME RES_TTL ); %EXPORT_TAGS = ( const => [ qw( REQ_ADDRESS REQ_TIMEOUT REQ_TIME REQ_USER_ARGS RES_ADDRESS RES_ROUNDTRIP RES_TIME RES_TTL ) ] ); use vars qw($VERSION $PKTSIZE); $VERSION = '1.171'; $PKTSIZE = $^O eq 'linux' ? 3_000 : 100; use Carp qw(croak); use Symbol qw(gensym); use Socket; use Time::HiRes qw(time); use POE::Session; sub DEBUG () { 0 } # Enable more information. sub DEBUG_SOCKET () { 0 } # Watch the socket open and close. sub DEBUG_PBS () { 0 } # Watch ping_by_seq management. # ping_by_seq structure offsets. sub PBS_POSTBACK () { 0 }; sub PBS_SESSION () { 1 }; sub PBS_ADDRESS () { 2 }; sub PBS_REQUEST_TIME () { 3 }; # request_packet offsets sub REQ_ADDRESS () { 0 }; sub REQ_TIMEOUT () { 1 }; sub REQ_TIME () { 2 }; sub REQ_USER_ARGS () { 3 }; # response_packet offsets sub RES_ADDRESS () { 0 }; sub RES_ROUNDTRIP () { 1 }; sub RES_TIME () { 2 }; sub RES_TTL () { 3 }; # ICMP echo constants. Types, structures, and fields. Cribbed # mercilessly from Net::Ping. sub ICMP_ECHOREPLY () { 0 } sub ICMP_ECHO () { 8 } sub ICMP_STRUCT () { 'C2 S3 A' } sub ICMP_SUBCODE () { 0 } sub ICMP_FLAGS () { 0 } sub ICMP_PORT () { 0 } # "Static" variables which will be shared across multiple instances. my $master_seq = 0; # Spawn a new PoCo::Client::Ping session. This basically is a # constructor, but it isn't named "new" because it doesn't create a # usable object. Instead, it spawns the object off as a session. # Randal Schwartz gave me heck about calling spawny things "new", so I # blame him for this naming convention. sub spawn { my $type = shift; croak "$type requires an even number of parameters" if @_ % 2; my %params = @_; # If we aren't given a socket, then we'll need privileges to create # one ourselves. croak "$type requires root privilege" if ( $> and ($^O ne "VMS") and ($^O ne "cygwin") and not defined $params{Socket} ); my $alias = delete $params{Alias}; $alias = "pinger" unless defined $alias and length $alias; my $timeout = delete $params{Timeout}; $timeout = 1 unless defined $timeout and $timeout >= 0; my $onereply = delete $params{OneReply}; my $socket = delete $params{Socket}; my $parallelism = delete $params{Parallelism} || -1; my $rcvbuf = delete $params{BufferSize}; my $always_decode = delete $params{AlwaysDecodeAddress}; my $retry = delete $params{Retry}; my $payload = delete $params{Payload}; # 56 data bytes :) $payload = 'Use POE!' x 7 unless defined $payload; croak( "$type doesn't know these parameters: ", join(', ', sort keys %params) ) if scalar keys %params; POE::Session->create( inline_states => { _start => \&poco_ping_start, ping => \&poco_ping_ping, clear => \&poco_ping_clear, got_pong => \&poco_ping_pong, _default => \&poco_ping_default, }, heap => { alias => $alias, always_decode => $always_decode, data => $payload, data_size => length($payload), keep_socket => (defined $socket) || 0, onereply => $onereply, rcvbuf => $rcvbuf, retry => $retry // 0, socket_handle => $socket, timeout => $timeout, # Active query tracking. ping_by_seq => { }, # keyed on sequence number addr_to_seq => { }, # keyed on request address, then sender # Queue to manage throttling. parallelism => $parallelism, # how many pings can we send at once queue => [ ], # ordered list of throttled pings pending => { }, # data for the sequence ids of queued pings outstanding => 0, # How many pings are we awaiting replies for }, ); undef; } # Start the pinger session. sub poco_ping_start { $_[KERNEL]->alias_set( $_[HEAP]->{alias} ); } # (NOT A POE EVENT HANDLER) # Create a raw socket to send ICMP packets down. # (optionally) mess with the size of the buffers on the socket. sub _create_handle { my ($kernel, $heap) = @_; DEBUG_SOCKET and warn "opening a raw socket for icmp"; my $protocol = (getprotobyname('icmp'))[2] or die "can't get icmp protocol by name: $!"; my $socket = gensym(); socket($socket, PF_INET, SOCK_RAW, $protocol) or die "can't create icmp socket: $!"; $heap->{socket_handle} = $socket; _setup_handle($kernel, $heap); } ### NOT A POE EVENT HANDLER sub _setup_handle { my ($kernel, $heap) = @_; if ($heap->{rcvbuf}) { unless ( setsockopt( $heap->{socket_handle}, SOL_SOCKET, SO_RCVBUF, pack("I", $heap->{rcvbuf}) ) ) { warn("setsockopt rcvbuf size ($heap->{rcvbuf}) failed: $!"); } } if ($heap->{parallelism} && $heap->{parallelism} == -1) { my $rcvbuf = getsockopt($heap->{socket_handle}, SOL_SOCKET, SO_RCVBUF); if ($rcvbuf) { my $size = unpack("I", $rcvbuf); my $max_parallel = int($size / $PKTSIZE); if ($max_parallel > 8) { $max_parallel -= 8; } elsif ($max_parallel < 1) { $max_parallel = 1; } $heap->{parallelism} = $max_parallel; } } $kernel->select_read($heap->{socket_handle}, 'got_pong'); } # Request a ping. This code borrows heavily from Net::Ping. sub poco_ping_ping { my ( $kernel, $heap, $sender, $event, $address, $timeout, $tries_left ) = @_[ KERNEL, HEAP, SENDER, ARG0, ARG1, ARG2, ARG3 ]; $tries_left //= $heap->{retry}; DEBUG and warn "ping requested for $address ($tries_left try/tries left)\n"; _do_ping( $kernel, $heap, $sender, $event, $address, $timeout, $tries_left, 0 ); } sub _do_ping { my ( $kernel, $heap, $sender, $event, $address, $timeout, $tries_left, $is_a_retry ) = @_; # No current pings. Open a socket, or setup the existing one. unless (scalar(keys %{$heap->{ping_by_seq}})) { unless (defined $heap->{socket_handle}) { _create_handle($kernel, $heap); } else { _setup_handle($kernel, $heap); } } # Get the timeout, or default to the one set for the component. $timeout = $heap->{timeout} unless defined $timeout and $timeout > 0; $tries_left = $heap->{retry} unless defined $tries_left; # Find an unused sequence number. while (1) { $master_seq = ($master_seq + 1) & 0xFFFF; last unless exists $heap->{ping_by_seq}->{$master_seq}; } my $checksum = 0; # Build the message without a checksum. my $msg = pack( ICMP_STRUCT . $heap->{data_size}, ICMP_ECHO, ICMP_SUBCODE, $checksum, ($$ & 0xFFFF), $master_seq, $heap->{data} ); ### Begin checksum calculation section. # Sum up short integers in the packet. my $shorts = int(length($msg) / 2); foreach my $short (unpack "S$shorts", $msg) { $checksum += $short; } # If there's an odd byte, add that in as well. $checksum += ord(substr($msg, -1)) if length($msg) % 2; # Fold the high short into the low one twice, and then complement. $checksum = ($checksum >> 16) + ($checksum & 0xFFFF); $checksum = ~( ($checksum >> 16) + $checksum) & 0xFFFF; ### Cease checksum calculation section. # Rebuild the message with the checksum this time. $msg = pack( ICMP_STRUCT . $heap->{data_size}, ICMP_ECHO, ICMP_SUBCODE, $checksum, ($$ & 0xFFFF), $master_seq, $heap->{data} ); # Record information about the ping request. my ($event_name, @user_args); if (ref($event) eq "ARRAY") { ($event_name, @user_args) = @$event; } else { $event_name = $event; } # Build an address to send the ping at. # TODO - This blocks, so resolve them first. # TODO - This assumes four-octet addresses are IPv4. my $usable_address = $address; if ($heap->{always_decode} || length($address) != 4) { $usable_address = inet_aton($address); } # Return failure if an address was not resolvable. This simulates # the postback behavior. unless (defined $usable_address) { $kernel->post( $sender, $event_name, [ $address, # REQ_ADDRESS $timeout, # REQ_TIMEOUT time(), # REQ_TIME @user_args, # REQ_USER_ARGS ], [ undef, # RES_ADDRESS undef, # RES_ROUNDTRIP time(), # RES_TIME undef, # RES_TTL ], ); _check_for_close($kernel, $heap); return; } my $socket_address = pack_sockaddr_in(ICMP_PORT, $usable_address); push(@{$heap->{queue}}, $master_seq); $heap->{pending}->{$master_seq} = [ $msg, # PEND_MSG $socket_address, # PEND_ADDR $sender, # PEND_SENDER $event, # PEND_EVENT $address, # PEND_ADDR ??? $timeout, # PEND_TIMEOUT $is_a_retry, # PEND_IS_RETRY ]; if ($tries_left and $tries_left > 1) { $heap->{retrydata}->{$master_seq} = [ $sender, # RD_SENDER $event, # RD_EVENT $address, # RD_ADDRESS $timeout, # RD_TIMEOUT $tries_left, # RD_RETRY ]; } _send_next_packet($kernel, $heap); } sub _send_next_packet { my ($kernel, $heap) = @_; return unless (scalar @{$heap->{queue}}); if ($heap->{parallelism} && $heap->{outstanding} >= $heap->{parallelism}) { # We want to throttle back since we're still waiting for pings # so, let's just leave this till later DEBUG and warn( "throttled since there are $heap->{outstanding} pings outstanding. " . "queue size=" . (scalar @{$heap->{queue}}) . "\n" ); return; } my $seq = shift(@{$heap->{queue}}); # May have been cleared by caller return unless (exists $heap->{pending}->{$seq}); my $ping_info = delete $heap->{pending}->{$seq}; my ( $msg, # PEND_MSG $socket_address, # PEND_ADDR $sender, # PEND_SENDER $event, # PEND_EVENT $address, # PEND_ADDR ??? $timeout, # PEND_TIMEOUT $is_a_retry, # PEND_IS_RETRY ) = @$ping_info; # Send the packet. If send() fails, then we bail with an error. my @user_args = (); ($event, @user_args) = @$event if ref($event) eq "ARRAY"; DEBUG and warn "sending packet sequence number $seq\n"; unless (send($heap->{socket_handle}, $msg, ICMP_FLAGS, $socket_address)) { $kernel->post( $sender, $event, [ $address, # REQ_ADDRESS $timeout, # REQ_TIMEOUT time(), # REQ_TIME @user_args, # REQ_USER_ARGS ], [ undef, # RES_ADDRESS undef, # RES_ROUNDTRIP time(), # RES_TIME undef, # RES_TTL ], ); _check_for_close($kernel, $heap); return; } # Record the message's length. This is constant, but we do it here # anyway. It's also used to flag when we start requesting replies. $heap->{message_length} = length($msg); $heap->{outstanding}++; # Set a timeout based on the sequence number. $kernel->delay( $seq => $timeout ); DEBUG_PBS and warn "recording ping_by_seq($seq)"; if ($is_a_retry) { # If retries, set the request time to the new/actual request time. # Inserted by Ralph Schmitt 2009-09-12. $heap->{ping_by_seq}->{$seq}->[PBS_REQUEST_TIME] = time(); } else { $heap->{ping_by_seq}->{$seq} = [ # PBS_POSTBACK $sender->postback( $event, $address, # REQ_ADDRESS $timeout, # REQ_TIMEOUT time(), # REQ_TIME @user_args, # REQ_USER_ARGS ), "$sender", # PBS_SESSION (stringified to weaken reference) $address, # PBS_ADDRESS time() # PBS_REQUEST_TIME ]; } # Duplicate pings? Forcibly time out the previous one. if (exists $heap->{addr_to_seq}->{$sender}->{$address}) { DEBUG and warn "Duplicate ping. Canceling $address"; my $now = time(); my $ping_info = _end_ping_by_requester_and_address( $kernel, $heap, $sender, $address ); $ping_info->[PBS_POSTBACK]->( undef, undef, $now, undef ); } $heap->{addr_to_seq}->{$sender}->{$address} = $seq; } # Clear a ping postback by address. The sender+address pair are a # unique ID into the pinger's data. sub poco_ping_clear { my ($kernel, $heap, $sender, $address) = @_[KERNEL, HEAP, SENDER, ARG0]; # Is the sender still waiting for anything? return unless exists $heap->{addr_to_seq}->{$sender}; # Try to clear a single ping if an address was specified. if (defined $address) { _end_ping_by_requester_and_address($kernel, $heap, $sender, $address); } # No address was specified. Clear all the pings for this session. else { _end_pings_by_requester($kernel, $heap, $sender); } _check_for_close($kernel, $heap); } # (NOT A POE EVENT HANDLER) # Check to see if no more pings are waiting. Close the socket if so. sub _check_for_close { my ($kernel, $heap) = @_; return unless exists $heap->{socket_handle}; return if scalar keys %{$heap->{ping_by_seq}}; DEBUG_SOCKET and warn "stopping raw socket watcher"; $kernel->select_read( $heap->{socket_handle} ); return if $heap->{keep_socket}; DEBUG_SOCKET and warn "closing raw socket"; delete $heap->{socket_handle}; } # (NOT A POE EVENT HANDLER) # Clean up after we're done with a ping. # Remove it from all tracking hashes. # Determine if the socket should be unthrottled or shut down. sub _end_ping_by_sequence { my ($kernel, $heap, $seq) = @_; # Delete the ping information. Cache a copy for other cleanup. DEBUG_PBS and warn "removing ping by sequence ($seq)"; my $ping_info = delete $heap->{ping_by_seq}->{$seq}; return unless $ping_info; # Stop its associated timeout. $kernel->delay($seq); # Stop mapping the session+address to this sequence number. my $pbs_session = $ping_info->[PBS_SESSION]; delete $heap->{addr_to_seq}->{$pbs_session}->{$ping_info->[PBS_ADDRESS]}; # Stop tracking the session if that was its last address. delete $heap->{addr_to_seq}->{$pbs_session} unless ( scalar(keys %{$heap->{addr_to_seq}->{$pbs_session}}) ); $heap->{outstanding}--; return $ping_info; } sub _end_ping_by_requester_and_address { my ($kernel, $heap, $sender, $address) = @_; return unless exists $heap->{addr_to_seq}->{$sender}; my $addr_to_seq_rec = $heap->{addr_to_seq}->{$sender}; my $seq = delete $addr_to_seq_rec->{$address}; unless ($seq) { # TODO - Why? delete $heap->{pending}->{$sender}->{$address}; return; } # Stop tracking the sender if that was the last address. delete $heap->{addr_to_seq}->{$sender} unless scalar( keys %{$heap->{addr_to_seq}->{$sender}} ); # Discard the postback for the discarded sequence number. DEBUG_PBS and warn "removing ping_by_seq($seq)"; my $ping_info = delete $heap->{ping_by_seq}->{$seq}; $kernel->delay($seq); $heap->{outstanding}--; return $ping_info; } sub _end_pings_by_requester { my ($kernel, $heap, $sender) = @_; return unless exists $heap->{addr_to_seq}->{$sender}; my $addr_to_seq_rec = delete $heap->{addr_to_seq}->{$sender}; # Discard cross references. foreach my $seq (values %$addr_to_seq_rec) { DEBUG_PBS and warn "removing ping_by_seq($seq)"; delete $heap->{ping_by_seq}->{$seq}; $kernel->delay($seq); $heap->{outstanding}--; } return; } # Something has arrived. Try to match it against something being # waited for. sub poco_ping_pong { my ($kernel, $heap, $socket) = @_[KERNEL, HEAP, ARG0]; # Record the receive time for possible use later. my $now = time(); # Receive a message on the ICMP port. my $recv_message = ''; my $from_saddr = recv($socket, $recv_message, 1500, ICMP_FLAGS); return unless $from_saddr; # We haven't yet sent a message, so don't bother with whatever we've # received. return unless defined $heap->{message_length}; # Unpack the packet's sender address. my ($from_port, $from_ip) = unpack_sockaddr_in($from_saddr); # Get the response packet's time to live. my ($ihl, $from_ttl) = unpack('C1@7C1', $recv_message); $ihl &= 0x0F; # Unpack the packet itself. my ( $from_type, $from_subcode, $from_checksum, $from_pid, $from_seq, $from_message ) = unpack( '@'.$ihl*4 . ICMP_STRUCT.$heap->{data_size}, $recv_message ); DEBUG and do { warn ",----- packet from ", inet_ntoa($from_ip), ", port $from_port\n"; warn "| type = $from_type / subtype = $from_subcode\n"; warn "| checksum = $from_checksum, pid = $from_pid, seq = $from_seq\n"; warn "| message: $from_message\n"; warn "`------------------------------------------------------------\n"; }; # Not an ICMP echo reply. Move along. return unless $from_type == ICMP_ECHOREPLY; DEBUG and warn "it's an ICMP echo reply"; # Not from this process. Move along. return unless $from_pid == ($$ & 0xFFFF); DEBUG and warn "it's from the current process"; # Not waiting for a response with that sequence number. Move along. return unless exists $heap->{ping_by_seq}->{$from_seq}; DEBUG and warn "it's one we're waiting for ($from_seq)"; # This is the response we're looking for. Calculate the round trip # time, and map it to a postback. my $trip_time = $now - $heap->{ping_by_seq}->{$from_seq}->[PBS_REQUEST_TIME]; $heap->{ping_by_seq}->{$from_seq}->[PBS_POSTBACK]->( inet_ntoa($from_ip), $trip_time, $now, $from_ttl ); # It's a single-reply ping. Clean up after it. if ($heap->{onereply}) { _end_ping_by_sequence($kernel, $heap, $from_seq); _send_next_packet($kernel, $heap); _check_for_close($kernel, $heap); } } # Default's used to catch ping timeouts, which are named after the # packed socket addresses being pinged. We always send the timeout so # the other session knows that a ping period has ended. sub poco_ping_default { my ($kernel, $heap, $seq) = @_[KERNEL, HEAP, ARG0]; # Record the receive time for possible use later. my $now = time(); # Are we waiting for this sequence number? We should be! unless (exists $heap->{ping_by_seq}->{$seq}) { warn "this shouldn't technically be displayed ($seq)" if ( DEBUG and $seq =~ /^\d+$/ ); return; } my $ping_info = _end_ping_by_sequence($kernel, $heap, $seq); my $retryinfo = delete $heap->{retrydata}->{$seq}; if ($retryinfo) { my ($sender, $event, $address, $timeout, $remaining) = @{$retryinfo}; DEBUG and warn("retrying ping for $address (", $remaining - 1, ")\n"); _do_ping($kernel, $heap, $sender, $event, $address, $remaining - 1, 1); return; } # Post a timer tick back to the session. This marks the end of # the request/response transaction. $ping_info->[PBS_POSTBACK]->( undef, undef, $now, undef ); _send_next_packet($kernel, $heap); _check_for_close($kernel, $heap); return; } 1; __END__ =head1 NAME POE::Component::Client::Ping - a non-blocking ICMP ping client =head1 SYNOPSIS use POE qw(Component::Client::Ping); POE::Component::Client::Ping->spawn( Alias => "pingthing", # defaults to "pinger" Timeout => 10, # defaults to 1 second Retry => 3, # defaults to 1 attempt OneReply => 1, # defaults to disabled Parallelism => 64, # defaults to autodetect BufferSize => 65536, # defaults to undef AlwaysDecodeAddress => 1, # defaults to 0 ); sub some_event_handler { $kernel->post( "pingthing", # Post the request to the "pingthing" component. "ping", # Ask it to "ping" an address. "pong", # Have it post an answer as a "pong" event. $address, # This is the address we want to ping. $timeout, # Optional timeout. It overrides the default. $retry, # Optional retries. It overrides the default. ); } # This is the sub which is called when the session receives a "pong" # event. It handles responses from the Ping component. sub got_pong { my ($request, $response) = @_[ARG0, ARG1]; my ($req_address, $req_timeout, $req_time) = @$request; my ($resp_address, $roundtrip_time, $resp_time, $resp_ttl) = @$response; # The response address is defined if this is a response. if (defined $resp_address) { printf( "ping to %-15.15s at %10d. pong from %-15.15s in %6.3f s\n", $req_address, $req_time, $resp_address, $roundtrip_time, ); return; } # Otherwise the timeout period has ended. printf( "ping to %-15.15s is done.\n", $req_address, ); } or use POE::Component::Client::Ping ":const"; # Post an array ref as the callback to get data back to you $kernel->post("pinger", "ping", [ "pong", $user_data ]); # use the REQ_USER_ARGS constant to get to your data sub got_pong { my ($request, $response) = @_[ARG0, ARG1]; my $user_data = $request->[REQ_USER_ARGS]; ...; } =head1 DESCRIPTION POE::Component::Client::Ping is non-blocking ICMP ping client. It lets several other sessions ping through it in parallel, and it lets them continue doing other things while they wait for responses. Ping client components are not proper objects. Instead of being created, as most objects are, they are "spawned" as separate sessions. To avoid confusion (and hopefully not cause other confusion), they must be spawned with a C method, not created anew with a C one. PoCo::Client::Ping's C method takes a few named parameters: =over 2 =item Alias => $session_alias C sets the component's alias. It is the target of post() calls. See the synopsis. The alias defaults to "pinger". =item Socket => $raw_socket C allows developers to open an existing raw socket rather than letting the component attempt opening one itself. If omitted, the component will create its own raw socket. This is useful for people who would rather not perform a security audit on POE, since it allows them to create a raw socket in their own code and then run POE at reduced privileges. =item Timeout => $ping_timeout C sets the default amount of time (in seconds) a Ping component will wait for a single ICMP echo reply before retrying. It is 1 by default. It is possible and meaningful to set the timeout to a fractional number of seconds. This default timeout is only used for ping requests that don't include their own timeouts. =item Retry => $ping_attempts C sets the default number of attempts a ping will be sent before it should be considered failed. It is 1 by default. =item OneReply => 0|1 Set C to prevent the Ping component from waiting the full timeout period for replies. Normally the ICMP protocol allows for multiple replies to a single request, so it's proper to wait for late responses. This option disables the wait, ending the ping transaction at the first response. Any subsequent responses will be silently ignored. C is disabled by default, and a single successful request will generate at least two responses. The first response is a successful ICMP ECHO REPLY event. The second is an undefined response event, signifying that the timeout period has ended. A ping request will generate exactly one reply when C is enabled. This reply will represent either the first ICMP ECHO REPLY to arrive or that the timeout period has ended. =item Parallelism => $limit Parallelism sets POE::Component::Client::Ping's maximum number of simultaneous ICMP requests. Higher numbers speed up the processing of large host lists, up to the point where the operating system or network becomes oversaturated and begin to drop packets. The difference can be dramatic. A tuned Parallelism can enable responses down to 1ms, depending on the network, although it will take longer to get through the hosts list. Pinging 762 hosts at Parallelism=64 Starting to ping hosts. Pinged 10.0.0.25 - Response from 10.0.0.25 in 0.002s Pinged 10.0.0.200 - Response from 10.0.0.200 in 0.003s Pinged 10.0.0.201 - Response from 10.0.0.201 in 0.001s real 1m1.923s user 0m2.584s sys 0m0.207s Responses will take significantly longer with an untuned Parallelism, but the total run time will be quicker. Pinging 762 hosts at Parallelism=500 Starting to ping hosts. Pinged 10.0.0.25 - Response from 10.0.0.25 in 3.375s Pinged 10.0.0.200 - Response from 10.0.0.200 in 1.258s Pinged 10.0.0.201 - Response from 10.0.0.201 in 2.040s real 0m13.410s user 0m6.390s sys 0m0.290s Excessively high parallelism values may saturate the OS or network, resulting in few or no responses. Pinging 762 hosts at Parallelism=1000 Starting to ping hosts. real 0m20.520s user 0m7.896s sys 0m0.297s By default, POE::Component::Client::Ping will guess at an optimal Parallelism value based on the raw socket receive buffer size and the operating system's nominal ICMP packet size. The latter figure is 3000 octets for Linux and 100 octets for other systems. ICMP packets are generally under 90 bytes, but operating systems may use alternative numbers when calculating buffer capacities. The component tries to mimic calculations observed in the wild. When in doubt, experiment with different Parallelism values and use the one that works best. =item BufferSize => $bytes If set, then the size of the receive buffer of the raw socket will be modified to the given value. The default size of the receive buffer is operating system dependent. If the buffer cannot be set to the given value, a warning will be generated but the system will continue working. Note that if the buffer is set too small and too many ping replies arrive at the same time, then the operating system may discard the ping replies and mistakenly cause this component to believe the ping to have timed out. In this case, you will typically see discards being noted in the counters displayed by 'netstat -s'. Increased BufferSize values can expand the practical limit for Parallelism. =item AlwaysDecodeAddress => 0|1 If set, then any input addresses will always be looked up, even if the hostname happens to be only 4 characters in size. Ideally, you should be passing addresses in to the system to avoid slow hostname lookups, but if you must use hostnames and there is a possibility that you might have short hostnames, then you should set this. =item Payload => $bytes Sets the ICMP payload (data bytes). Otherwise the component generates 56 data bytes internally. Note that some firewalls will discard ICMP packets with nonstandard payload sizes. =back Sessions communicate asynchronously with the Client::Ping component. They post ping requests to it, and they receive pong events back. Requests are posted to the component's "ping" handler. They include the name of an event to post back, an address to ping, and an optional amount of time to wait for responses. The address may be a numeric dotted quad, a packed inet_aton address, or a host name. Host names are not recommended: they must be looked up for every ping request, and DNS lookups can be very slow. The optional timeout overrides the one set when C is called. Ping responses come with two array references: my ($request, $response) = @_[ARG0, ARG1]; C<$request> contains information about the original request: my ( $req_address, $req_timeout, $req_time, $req_user_args, ) = @$request; =over 2 =item C<$req_address> This is the original request address. It matches the address posted along with the original "ping" request. It is useful along with C<$req_user_args> for pairing requests with their corresponding responses. =item C<$req_timeout> This is the original request timeout. It's either the one passed with the "ping" request or the default timeout set with C. =item C<$req_time> This is the time that the "ping" event was received by the Ping component. It is a real number based on the current system's time() epoch. =item C<$req_user_args> This is a scalar containing arbitrary data that can be sent along with a request. It's often used to provide continuity between requests and their responses. C<$req_user_args> may contain a reference to some larger data structure. To use it, replace the response event with an array reference in the original request. The array reference should contain two items: the actual response event and a scalar with the context data the program needs back. See the SYNOPSIS for an example. =back C<$response> contains information about the ICMP ping response. There may be multiple responses for a single request. my ($response_address, $roundtrip_time, $reply_time, $reply_ttl) = @$response; =over 2 =item C<$response_address> This is the address that responded to the ICMP echo request. It may be different than C<$request_address>, especially if the request was sent to a broadcast address. C<$response_address> will be undefined if C<$request_timeout> seconds have elapsed. This marks the end of responses for a given request. Programs can assume that no more responses will be sent for the request address. They may use this marker to initiate another ping request. =item C<$roundtrip_time> This is the number of seconds that elapsed between the ICMP echo request's transmission and its corresponding response's receipt. It's a real number. This is purely the trip time and does *not* include any time spent queueing if the system's parallelism limit caused the ping transmission to be delayed. =item C<$reply_time> This is the time when the ICMP echo response was received. It is a real number based on the current system's time() epoch. =item C<$reply_ttl> This is the ttl for the echo response packet we received. =back If the ":const" tagset is imported the following constants will be exported: REQ_ADDRESS, REQ_TIMEOUT, REQ_TIME REQ_USER_ARGS, RES_ADDRESS, RES_ROUNDTRIP, RES_TIME, RES_TTL =head1 SEE ALSO This component's ICMP ping code was lifted from Net::Ping, which is an excellent module when you only need to ping one host at a time. See POE, of course, which includes a lot of documentation about how POE works. Also see the test program, t/01_ping.t, in the component's distribution. =head1 BUG TRACKER https://rt.cpan.org/Dist/Display.html?Queue=POE-Component-Client-Ping =head1 REPOSITORY http://github.com/rcaputo/poe-component-client-ping/ =head1 OTHER RESOURCES http://search.cpan.org/dist/POE-Component-Client-Ping/ =head1 AUTHOR & COPYRIGHTS POE::Component::Client::Ping is Copyright 1999-2009 by Rocco Caputo. All rights are reserved. POE::Component::Client::Ping is free software; you may redistribute it and/or modify it under the same terms as Perl itself. You can learn more about POE at http://poe.perl.org/ =cut