Hi,

        I've been having a few problems using POE under Cygwin, on a 
W2K PRO.. one of them has to do with a socket problem.  It appears
that on POE+cygwin, the "FailureEvent" of a POE::Wheel::SocketFactory
for connecting never gets called... tha script just hangs when there's
nothing listening on the remoteport.  Below is a simple script i'm
using for testing.  Both failure and success work fine under Linux,
but only success works on cygwin.  Instead of failing, the results
are:

$ ./nect.pl
 ... Going to connect

        And it just hang's there, until i cancel it with Ctrl-C.  I'm
using POE-0.22 and Cygwin's uname-a: 

CYGWIN_NT-5.0 TSUNAMI 1.3.10(0.51/3/2) 2002-02-25 11:14 i686 unknown

        Has anyone had this kind of problem before?  Thanks.

Cristiano Lincoln Mattos

---

#!/usr/bin/perl

use POE;
use POE::Kernel;
use POE::Session;
use POE::Wheel::SocketFactory;

POE::Session->create
        ( inline_states => 
                { _start => \&_start,
                  _stop => \&_stop,
                  newConnection => \&newConnection,
                  failedConnecting => \&failedConnecting
                }
        );

sub _start {
    my ($self, $session, $heap, $kernel) = @_[OBJECT, SESSION, HEAP, KERNEL];
        print " ... Going to connect \n";
    my $connect = new POE::Wheel::SocketFactory (
                            RemoteAddress => "127.0.0.1",
                            RemotePort => 3000,
                            SocketProtocol => "tcp",
                            Reuse => "yes",
                            SuccessEvent => "newConnection",
                            FailureEvent => "failedConnecting"
                          );
        $heap->{wheel} = $connect;
}

sub _stop {
    my ($self, $session, $heap, $kernel) = @_[OBJECT, SESSION, HEAP, KERNEL];
    print("Inside Stop\n");
}

sub newConnection {
    my ($self, $session, $heap, $kernel) = @_[OBJECT, SESSION, HEAP, KERNEL];
    my ($socket, $peeraddr, $peerport) = @_[ARG0 .. ARG2];

    print ("Inside newConnection \n");
}

sub failedConnecting {
    my ($self, $session, $heap, $kernel) = @_[OBJECT, SESSION, HEAP, KERNEL];
    print("Inside failedConnecting()\n");
}

$poe_kernel->run();


Reply via email to