On Mon, Jul 23, 2001 at 01:00:46PM -0600, Chris Fedde wrote:
> It seems that the handle in ARG0 from the SuccessEvent of
> POE::Wheel::SocketFactory is not an IO::Socket.
> I can't find any way for the session that is handling that event to get
> arbitrary arguments.  Am I just missing something obvious?

It's a plain filehandle, really.  You can call builtin functions on it:

  my $socket = $_[ARG0];
  my ($local_port, $local_address) = getsockname($socket);
  print( "my side of the socket is at ",
         gethostbyaddr($local_address, AF_INET), # assumes INET
         " [", inet_ntoa($local_address), "] port $local_port\n"
       );

If IO::Socket is just a wrapper for socket handles, you can bless them
into that package.  I don't know if this works.

  my $socket = bless $_[ARG0], 'IO::Socket';

or

  my $socket = bless $_[ARG0], 'IO::Socket::INET';

-- Rocco Caputo / [EMAIL PROTECTED] / poe.perl.org / poe.sourceforge.net

Reply via email to