develooper Front page | perl.poe | Postings from August 2001

Problems using SocketFactorys on WinNT

Thread Next
From:
Mark Fowler
Date:
August 15, 2001 10:49
Subject:
Problems using SocketFactorys on WinNT
Message ID:
Pine.LNX.4.33.0108151716280.25010-100000@ns0.astray.com
As I explained on #poe I've been having problems using SocketFactorys on
NT boxes.  To cut to the chase, this is some code that doesn't work:

##########################################################################

#!/usr/bin/perl

# This code doesn't work under Active State 628, latest version of
# the POE ppm from poe.souceforge.net, and NT4.  Works fine under Linux.

# gives the error "wheel 2 encountered connect error 10022: Unknown error"
# which is MS speak for "Invalid Argument" in the sockets library
# apparently

use POE qw(Wheel::SocketFactory Session);

new POE::Session
(
    _start => \&start,
    _stop  => \&stop,

    connected => \&connected,
    problem   => \&problem,
);
$poe_kernel->run();

sub start
{
   POE::Wheel::SocketFactory->new
      ( RemoteAddress => "2shortplanks.com",
        RemotePort    => "80",
        SuccessState  => 'connected',
        FailureState  => 'problem',
      );
}

sub connected
{
  # do stuff
}

sub problem
{
  my ($heap, $operation, $errnum, $errstr, $wheel_id)
     = @_[HEAP, ARG0..ARG3];
  print "wheel $wheel_id encountered $operation error $errnum: $errstr\n";
}

sub stop {}

##########################################################################

Now as the comments say this works fine on my Linux box, but not on the
NT boxes I've tried it on.   I've been assured however that this example
does run okay on Windows 2000....Hmm.

I had a peek around the code in POE::Wheel::SocketFactory and found that
the problem was at line 723, when it does a:

   connect($socket_handle, $connect_address)

But I can't see what's wrong with this, or the code above.  I must admit
that I'm not very au fait with socket coding, and even less so on Windows
NT.

Any help, advice, pointers in the right direction or plain ridicule if
I've done something basically wrong sought after.

Thanks.

Mark.

-- 
s''  Mark Fowler                                     London.pm   Bath.pm
     http://www.twoshortplanks.com/              mark@twoshortplanks.com
';use Term'Cap;$t=Tgetent Term'Cap{};print$t->Tputs(cl);for$w(split/  +/
){for(0..30){$|=print$t->Tgoto(cm,$_,$y)." $w";select$k,$k,$k,.03}$y+=2}


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About