Here's an example taken directly from the POE::Wheel::SocketFactory manpage.

       A sample SuccessEvent handler:

         sub server_accept {
           my $accepted_handle = $_[ARG0];

           my $peer_host = inet_ntoa($_[ARG1]);
           print( "Wheel $_[ARG3] accepted a connection from ",
                  "$peer_host port $peer_port\n"
                );
           # Do something with the new connection.
           &spawn_connection_session( $accepted_handle );
         }

       For INET sockets, "ARG1" and "ARG2" hold the socket's
       remote address and port, respectively.  The address is
       packed; use inet_ntoa() (See Socket) if a human-readable
       version is necessary.

HTH,
Todd



On (Thu, Jul 24 13:22), Gooly wrote:
> 
> Please give me a hint how can I get th IP-Addr. of the connecting client in 
> this function (of the chat-server):
> 
> sub client_connected {
>     my $session_id = $_[SESSION]->ID;
>     $users{$session_id} = 1;
>     broadcast( \%studio, $session_id, "1 Client connected." );
> }
> 

Reply via email to