I've never posted a code segment to a mailing list. I hope I'm doing this
right. If not, please pardon me...
I need to write a multiplexed TCP server to handle multiple client
connections simultaneously. It doesn't help that I'm new to perl and even
newer to TCP. If this helps, I'm basing my code on an example on pp.
352-358 of Network Programming with Perl, Lincoln D. Stein, 2001. I need to
store the socket handles in a hash with the IP of the client as the index,
because the traffic to be sent to the clients will come prefaced by the
recipient IP. How do I retrieve the client IP after or from the "$connect =
$listen_socket->accept();" statement? I've seen it done with other connect
and bind methods.
The socket object has a peeraddr() method. You can also get it by calling accept() in list context, if memory serves:
($connection, $peeraddr) = $listen_socket->accept();
Hope that helps.
James
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>