I didnt test udp much, as its not running everywhere here, but now I see you are right.. Seems I should have read HP-UXs docs more closely:

recvfrom() operates in the same manner as recv() except that it is abl +e to return the address of the socket from which the message was sent +. For connected datagram sockets, recvfrom() simply returns the same + address as getpeername() (see getpeername(2)). For stream sockets, +recvfrom() retrieves data in the same manner as recv(), but does not +return the socket address of the sender.
So it returns the address for udp, but not for tcp.
You did try it *on* the OSes mentioned, and not *to* them, right? (It should work fine from Linux, at least, it does here.)

Anyfish, I see someone already reported on libnet that the recv line should be changed to check for 'defined', about 8 months ago, and it hasn't been changed yet.. (OTOH the explanation why possibly wasn't very clear) So I'll probably write to him and ask. (Seeing as there was a new libnet recently, just not fixing that bug..)

After looking at various docs I'm now all confused as to whats incorrect. perldoc recv says:

Returns the address of the sender if SOCKET's protocol supports this; +returns an empty string otherwise.
What does it mean with "SOCKET's protocol"? I assumed that meant tcp or udp etc. In which case different behavior on hp and on linux is a bug. If it just means 'supported at all', then it's just a misleading doc.. Further, the recv/recvfrom manpage on Linux says they all return the length of the data received, bah, I'm confused ,)

C.


In reply to Re: Re: perldoc recv, Net::Time and HP-UX by castaway
in thread perldoc recv, Net::Time and HP-UX by castaway

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.