AnyEvent-Ping

 view release on metacpan or  search on metacpan

lib/AnyEvent/Ping.pm  view on Meta::CPAN

    $socket->sysread(my $chunk, 4194304, 0);

    my $icmp_msg = substr $chunk, 20;

    my ($type, $identifier, $sequence, $data);

    $type = unpack 'c', $icmp_msg;

    if ($type == $ICMP_ECHOREPLY) {
        ($type, $identifier, $sequence, $data) =
          (unpack $ICMP_PING, $icmp_msg)[0, 3, 4, 5];
    }
    elsif ($type == $ICMP_DEST_UNREACH || $type == $ICMP_TIME_EXCEEDED) {
        ($identifier, $sequence) = unpack('nn', substr($chunk, 52));
    }
    else {

        # Don't mind
        return;
    }

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.623 second using v1.00-cache-2.02-grep-82fe00e-cpan-48ebf85a1963 )