Really, there are two problems - why host is unreachable and why "Bad arg length" error appears.

You could read the discussion of both the problems here. Solution is in Msg5.

For impatient:

Host is unreachable because Net::Ping being used with UDP or TCP checks it via echo service (port 7). This service is down by default on some linux and BSD (one man said me that it is due to security reason). Solution: use ICMP (and run as root) or switch on echo service on remote host.

"Bad arg length" error appears if remote host is unreachable (may be it is the result of the first problem). Simple patch to Net::Ping - while waiting package you should check return value of recv and do nothing if it is false.

Patch for Net::Ping 2.02 - change line 373

$from_saddr = recv($self->{"fh"}, $from_msg, 1500, $flags);

to

$from_saddr = recv($self->{"fh"}, $from_msg, 1500, $flags) or last;

and you will have remote host unreachable instead of the error.

Could anybody tell me - where and how should I officially submit this patch?

-- brother ab

In reply to Re: Net::Ping just don't werk by brother ab
in thread Net::Ping just don't werk by JPaul

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.