castaway has asked for the wisdom of the Perl Monks concerning the following question:
How so? Well, I'm attempting to use the Net::Time module, to grab the current time from a remote machine. This fairly simple code works fine on Linux, but not on HP:
('volvo' is the HP-UX machine, which means Linux can get the time from HP-UX, but HP-UX can't get it from itself..)perl -MNet::Time=inet_time -le'print inet_time("volvo", "tcp", 10);'
After digging in the code, I noticed the problem is with the following:
Looking at the docs for 'recv', it should return the senders address, if supported by the socket protocol (I assume udp and tcp do, since both can be used for the time protocol), and an empty string otherwise, and undef on error. recv is based on the system call recvfrom. So this code should actually be checking for undef, and indeed changing this solved the problem, for the Net::Time module.return undef unless $s->recv($buf, length(pack("N",0)));
So wheres the bug? The manpage for 'recvfrom' on the HP-UX 11.0 machine says, explicitly, that the 'recvfrom' system call behaves the same way as the 'recv' system call, except that it does not return the senders address. Thus perls 'recv' does not behave according to its documentation, on HP-UX.
This was all tested with v5.6.1 perl + docs, and the latest libnet from CPAN (which contains Net::Time). I also peeked at the v5.8.0 docs for recv, which claim the same thing, and in the Net::Time module in the 5.8.0 core, which has the same bug.
Since I'm not subscribed to p5p (and don't aspire to be), where else should I report this, apart from the RT for libnet?
And would anyone else like to confirm it?
C. (breaking things today..)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perldoc recv, Net::Time and HP-UX
by KPeter0314 (Deacon) on Jun 19, 2003 at 19:19 UTC | |
by castaway (Parson) on Jun 20, 2003 at 06:59 UTC | |
by KPeter0314 (Deacon) on Jun 20, 2003 at 15:23 UTC |