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

The address will be in sockaddr_in format, similar to that passed to bind. See the examples in Sockets: Client/Server Communication in perlipc.
  • Comment on Re: IO::Socket->recv() method documentation?

Replies are listed 'Best First'.
Re^2: IO::Socket->recv() method documentation?
by BrowserUk (Patriarch) on Apr 07, 2011 at 18:37 UTC
    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.

      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?

Re^2: IO::Socket->recv() method documentation?
by Illuminatus (Curate) on Apr 07, 2011 at 13:26 UTC
    cdarke's response does pre-suppose that you are using ipv4 sockets. I have never tried it with a UNIX-domain socket, so I don't know if it would return the path to the fifo, or nothing. An ipv6 socket would return sockaddr_in6. I have no idea what a TIPC socket would return.

    fnord