in reply to IO::Socket doing getpeername twice on every send?

I don't know the internals of IO::Socket, but it seems like this might cause trouble with a persistent LISTEN socket. Have you tested that case?

After Compline,
Zaxo

  • Comment on Re: IO::Socket doing getpeername twice on every send?

Replies are listed 'Best First'.
Re^2: IO::Socket doing getpeername twice on every send?
by cazz (Pilgrim) on Feb 23, 2005 at 15:42 UTC
    Internally, IO::Socket passes around a seperate $sock for each connection. Well, I tested my change by taking the nonblock example from the Perl Cookbook, making it use persistent LISTEN sockets, and then adding the following code in the request handling sub.
    print "GOT LEN " . length($client->peername) . "\n"; my($port, $ipaddr) = sockaddr_in($client->peername); print "GOT PORT $port\n";
    I connected from multiple hosts, getting the right port each time, then restarted the listener, connected again from multiple hosts and still got the expected results from my inserted block of code.