POE::Component::Client::Ping

POE::Component::Client::Ping is a non-blocking ICMP ping client.
Download

POE::Component::Client::Ping Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Rocco Caputo
  • Publisher web site:
  • http://search.cpan.org/~apocal/

POE::Component::Client::Ping Tags


POE::Component::Client::Ping Description

POE::Component::Client::Ping is a non-blocking ICMP ping client. POE::Component::Client::Ping is a non-blocking ICMP ping client.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 => 20, # defaults to undef 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) = @_; 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 d. pong from %-15.15s in %6.3f sn", $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", ); # use the REQ_USER_ARGS constant to get to your data sub got_pong { my ($request, $response) = @_; my $user_data = $request->; ...; } Requirements: · Perl


POE::Component::Client::Ping Related Software