in reply to Re: IO::Socket->recv() method documentation?
in thread IO::Socket->recv() method documentation?

The address will be in sockaddr_in format,

Is that a scalar, an array, a hash or some kind of object?

similar to that passed to bind.

What is bind? As an IO::Socket user, I've never had to bind anything.

See the examples in Sockets: Client/Server Communication in perlipc.

There aren't any IO::Socket udp examples in perlipc.

And what code is in there seems to be written in some foreign language? Like C with dollars.

Half of the examples don't compile with strict even though someone has stuck a big my block of horribly named variables at the top.

If the modernists want something to do to make Perl look more modern, that would be a better starting place than trying to convert the world to the OOne trOO way :)


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re^2: IO::Socket->recv() method documentation?

Replies are listed 'Best First'.
Re^3: IO::Socket->recv() method documentation?
by ikegami (Patriarch) on Apr 07, 2011 at 19:34 UTC

    Is that a scalar, an array, a hash or some kind of object?

    A packed string/structure. Socket and thus IO::Socket provides tools.

    use Socket qw( sockaddr_in inet_ntoa ); my ($port, $packed_addr) = sockaddr_in($peer); my $addr = inet_ntoa($packed_addr);

    This answer is specific to IPv4.

    What is bind? As an IO::Socket user, I've never had to bind anything.

    You'd know it as LocalPort.

      Have you heard the term: devil's advocate?

        Yes. Are you saying you are playing the devil's advocate (trying to show that the code should behave unintuitively by taking the opposite position)? That makes no sense to me.