Hello, I am trying to write Perl code to ping an ipv6 machine, and have bellow code which fails to ping. Need your help to understand correct flow. I am using 2.63 version of Net::ping
#!/usr/bin/perl use Net::Ping; my $host = 'Virt-titan-26'; my $pings_timeout = 15; # seconds print("Pinging host [$host]...\n"); # Modified ping to accept $family(ipv6) as seson parameter my $ping = Net::Ping->new('icmpv6', 'ipv6'); $ping->hires(1); my $single_ping_timeout = 5.0; # seconds my $pings_start_time = time; while (1) { my ($ret, $pingtime, $ip) = $ping->ping($host, $single_ping_timeout) +; my $pings_duration = time - $pings_start_time; # print("\n\n\nAnand : $ip\n\n\n\n"); if ($ret) { print("Host [$host ($ip)] responded to ping \n"); last; } else { print("\nHost [$host ($ip)] did NOT respond to ping \n"); } if ($pings_duration >= $pings_timeout) { print("\nHost [$host ($ip)] did not respond to any pings within +timeout of \n"); exit; } print("\nSleep\n"); sleep(1); } print("\nVerified ping connectivity to host \n");
------------------- Output:
C:\Users\Administrator>perl C:\test-ping.pl Pinging host [Virt-titan-26]... Host [Virt-titan-26 (xxxx)] did NOT respond to ping Sleep Host [Virt-titan-26 (xxx)] did NOT respond to ping Sleep Host [Virt-titan-26 (xxx)] did NOT respond to ping Host [Virt-titan-26 (xxx)] did not respond to any pings within timeout + of

In reply to IPV6 ping code not working by amanjal

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.