Subject: | FW: POE::Component::Client::Ping roundtriptime question |
Date: | Fri, 24 Jul 2009 20:51:47 +0100 |
To: | <bug-POE-Component-Client-Ping [...] rt.cpan.org> |
From: | <Dean.Holroyd [...] TeleCity.com> |
Show quoted text
-----Original Message-----
From: Rocco Caputo [mailto:rcaputo@pobox.com]
Sent: Fri 24/07/2009 18:02
To: Dean Holroyd
Subject: Re: POE::Component::Client::Ping roundtriptime question
It seems like a defect. If the network is responding in relatively
constant time, then the component should report that. Can you send a
copy of your message to bug-POE-Component-Client-Ping@rt.cpan.org so
it enters the component's request tracker?
I don't have a Windows machine to test this with Strawberry Perl.
Finding a resolution could take longer if I can't reproduce it on a
Unixy system. I should be able to if the issue is in application space.
--
Rocco Caputo - rcaputo@pobox.com
On Jul 24, 2009, at 12:25, <Dean.Holroyd@TeleCity.com> <Dean.Holroyd@TeleCity.com
> wrote:
> Hi Rocco
>
> I have been testing your ping component under strawberry perl. I
> would be grateful if you could answer a question?
>
> If the test address array is filled with more addresses (e.g. 255),
> the response times seem to get longer and longer the larger the
> array. Should this happen if this is non blocking?
>
> (see results at end of email)
>
> Thanks for your time
>
> Dean
>
>
>
> #!/usr/bin/perl -w
> # $Id$
> #use warnings; # or -w above
> #use strict;
> use NetAddr::IP;
>
> BEGIN {
> die "POE::Component::Client::Ping requires root privilege\n"
> if $> and ($^O ne 'VMS');
> }
> use POE;
> use POE::Component::Client::Ping;
>
> # How many seconds to wait for ping responses.
> sub PING_TIMEOUT () { 5 }
>
> #------------------------------------------------------------------------------
> # A bunch of addresses generated from a prefix/mask pair
> $prefix = "209.85.227.0/24";
> my $ip = new NetAddr::IP($prefix);
>
> $count = 0;
> while ($ip < $ip->broadcast) {
> @ipaddress = split('/', $ip);
> @hostArray[$count] = $ipaddress[0];
> #print @hostArray[$count]."\n";
> $count ++;
> $ip ++;
> }
>
> #------------------------------------------------------------------------------
> # The main loop.
> # Create a pinger component. This will do the work of multiple
> # concurrent pings. It requires another session to interact with it.
> POE::Component::Client::Ping->spawn(
> Alias => 'pinger', # The component's name will be "pinger".
> Timeout => PING_TIMEOUT, # The default ping timeout.
> );
>
> # Create a session that will use the pinger. Its parameters match
> # event names with the functions that will handle them.
> POE::Session->create(
> inline_states => {
> _start => \&client_start, # Call client_start() to handle
> "_start".
> pong => \&client_got_pong, # Call client_got_pong() to
> handle "pong".
> }
> );
>
> # Start POE's main loop. It will only return when everything is done.
> $poe_kernel->run();
> exit;
>
> #------------------------------------------------------------------------------
> # Event handlers.
> # Handle _start (given by POE itself to start your session) by sending
> # several "ping" commands to the component at once. The component
> # will reply over the course of PING_TIMEOUT seconds.
> sub client_start {
> my ($kernel, $session) = @_[KERNEL, SESSION];
> print "Starting to ping hosts.\n";
> foreach my $address (@hostArray) {
> #print "Pinging $address at ", scalar(localtime), "\n";
>
> # "Pinger, do a ping and return the results as a pong event. The
> # address to ping is $ping."
> $kernel->post(pinger => ping => pong => $address);
> }
> }
>
> # Handle a "pong" event (returned by the Ping component because we
> # asked it to). Just display some information about the ping.
> sub client_got_pong {
> my ($kernel, $session) = @_[KERNEL, SESSION];
>
> # The original request is returned as the first parameter. It
> # contains the address we wanted to ping, the total time to wait for
> # a response, and the time the request was made.
> my $request_packet = $_[ARG0];
> my ($request_address, $request_timeout, $request_time) =
> @{$request_packet};
>
> # The response information is returned as the second parameter. It
> # contains the response address (which may be different from the
> # request address), the ping's round-trip time, and the time the
> # reply was received.
> my $response_packet = $_[ARG1];
> my ($response_address, $roundtrip_time, $reply_time) =
> @{$response_packet};
>
> # It is impossible to know ahead of time how many ICMP ping
> # responses will arrive for a particular address, so the component
> # always waits PING_TIMEOUT seconds. An undefined response address
> # signals that this waiting period has ended.
> if (defined $response_address) {
> printf("Pinged %-15.15s - Response from %-15.15s in %6.3fs\n",
> $request_address, $response_address, $roundtrip_time);
> }
> else {
> #print "Time's up for responses from $request_address.\n";
> }
> }
>
> RESPONSES from poe ping
>
>
> Pinged 209.85.227.244 - Response from 209.85.227.244 in 0.182s
> Pinged 209.85.227.242 - Response from 209.85.227.242 in 0.184s
> Pinged 209.85.227.245 - Response from 209.85.227.245 in 0.192s
> Pinged 209.85.227.253 - Response from 209.85.227.253 in 0.187s
> Pinged 209.85.227.248 - Response from 209.85.227.248 in 0.191s
> Pinged 209.85.227.252 - Response from 209.85.227.252 in 0.189s
> Pinged 209.85.227.254 - Response from 209.85.227.254 in 0.188s
>
> Response using ping.exe for the last host.
>
> C:\>ping 209.85.227.254
>
> Pinging 209.85.227.254 with 32 bytes of data:
>
> Reply from 209.85.227.254: bytes=32 time=79ms TTL=246
> Reply from 209.85.227.254: bytes=32 time=125ms TTL=246
> Reply from 209.85.227.254: bytes=32 time=65ms TTL=246
> Reply from 209.85.227.254: bytes=32 time=73ms TTL=246
>
> Ping statistics for 209.85.227.254:
> Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
> Approximate round trip times in milli-seconds:
> Minimum = 65ms, Maximum = 125ms, Average = 85ms
>
>
> --
> Dean Holroyd - Senior Network Engineer
> TelecityGroup International Limited Unit 3 Williams House,
> Manchester Science Park, Lloyd Street North, Manchester, M15 6SE,
> United Kingdom
> T: +44 161 232 3291 M: +44 772 596 1680 F: +44 870 750 2993
> www.telecitygroup.com
>
> TelecityGroup - Driving leadership, innovation and environmental
> responsibility for the data centre industry.
>
> . Early adopter of the EU Code of Conduct for data centres and
> Member of the Green Grid
> . A FTSE techMARK, FTSE4Good and FTSE 250 Index company
>
> TelecityGroup UK Limited. Registered in England 3607764 Registered
> Office: Masters House, 107 Hammersmith Road, London W14 0QH UK. VAT
> No. 766825682
>
> No binding contract will be made between an employee of
> TelecityGroup and a third party either verbally or by email, until a
> written document has been signed on behalf of TelecityGroup.
>
>
> This e-mail is intended only for the use of the addressees named
> above and may be confidential. If you are not an addressee you must
> not use any information contained in nor copy it nor inform any
> person other than the addressees of its existence or contents.
> Please consider the environment before printing this e-mail.
>
--
Dean Holroyd - Senior Network Engineer
TelecityGroup International Limited Unit 3 Williams House, Manchester Science Park, Lloyd Street North, Manchester, M15 6SE, United Kingdom
T: +44 161 232 3291 M: +44 772 596 1680 F: +44 870 750 2993
www.telecitygroup.com
TelecityGroup - Driving leadership, innovation and environmental responsibility for the data centre industry
. Early adopter of the EU Code of Conduct for data centres and Member of the Green Grid
. A FTSE techMARK, FTSE4Good and FTSE 250 Index company
TelecityGroup UK Limited. Registered in England 3607764 Registered Office: Masters House, 107 Hammersmith Road, London W14 0QH UK. VAT No. 766825682
No binding contract will be made between an employee of TelecityGroup and a third party either verbally or by email, until a written document has been signed on behalf of TelecityGroup.
This e-mail is intended only for the use of the addressees named above and may be confidential. If you are not an addressee you must not use any information contained in nor copy it nor inform any person other than the addressees of its existence or contents. Please consider the environment before printing this e-mail.
Message body is not shown because it is too large.