Wow, this seems nastier than I was hoping.  I didn't
think about the dual CPU boxes and such that could
cause a non-blocking connect to really connect
or return the error code immediately.  I also still
think that it COULD be a matter of Fcntl because when
I comment out this section:

$ grep -2 fcntl lib/Net/Ping.pm 
  # Set O_NONBLOCK property on filehandle
  my $flags = 0;
  if (fcntl($fh, F_GETFL, $flags)) {
    if (!fcntl($fh, F_SETFL, $flags | O_NONBLOCK)) {
      croak("fcntl F_SETFL: $!");
    }
  } else {
    croak("fcntl F_GETFL: $!");
  }


everything happens and fails exactly like you say
occurs on freebsd and solaris boxes even on linux.
And this is exactly the behavior on Win32 platform
whether I comment it out or not.

NOTE: If this is not the most correct way to do a
nonblocking tcp connect, then tell me and I'll make
the repairs.  How does &IO::Handle::blocking or
&IO::Socket::INET::connect implement it?  Similar,
right?

Okay, I'm even handling this case too.  Are there
any errors now?  Do a whole "make test":

cvs -z3 -q -d :pserver:[EMAIL PROTECTED]:/usr/local/cvsroot/freeware checkout 
Net-Ping
cd Net-Ping
perl Makefile.PL
make
make test


Dang, I wish I had a Solaris or FreeBSD box to run
this test on.  I hate bothering y'all (not to mention
bloating my cvs server with cruffy revisions).  This
is getting frustrating.


--
Rob


On Tue, 22 Oct 2002, Dan Kogai wrote:

> On Tuesday, Oct 22, 2002, at 03:32 Asia/Tokyo, Blair Zajac wrote:
> > This worked for me on Irix on perl 5.6.1 and 5.8.0.
> 
> Still not good'uff on FreeBSD;
> 
> > > sudo perl -Mblib t/450_service.t      Password:1..26
> > # Running under perl version 5.008 for freebsd
> > # Current time local: Mon Oct 21 18:55:24 2002
> > # Current time GMT:   Tue Oct 22 03:55:24 2002
> > # Using Test.pm version 1.22
> > ok 1
> > ok 2
> > ok 3
> > ok 4
> > ok 5
> > ok 6
> > ok 7
> > ok 8
> > ok 9
> > ok 10
> > ok 11
> > ok 12
> > WARNING: Nonblocking connect connected anyway? (freebsd) at 
> > /usr/home/dankogai/work/Net-Ping/blib/lib/Net/Ping.pm line 779.
> > ok 13
> > ok 14
> > ok 15
> > ok 16
> > ok 17
> > not ok 18
> > # Failed test 18 in t/450_service.t at line 145
> > #  t/450_service.t line 145 is: ok $p -> ack();
> > ok 19
> > ok 20
> > WARNING: Nonblocking connect connected anyway? (freebsd) at 
> > /usr/home/dankogai/work/Net-Ping/blib/lib/Net/Ping.pm line 779.
> > ok 21
> > ok 22
> > ok 23
> > ok 24
> > not ok 25
> > # Failed test 25 in t/450_service.t at line 186
> > #  t/450_service.t line 186 is: if (!ok $p -> ping("127.0.0.1")) {warn 
> > "ERRNO: $!";}
> > ERRNO: Connection refused at t/450_service.t line 186.
> > ok 26
> 
> It's not a matter of Fcntl.  There are many (and more and more) systems 
> that refuse SYN.  Rob, I strongly suggest you change your default 
> platform to OpenBSD or FreeBSD if OpenBSD is too difficult to install.  
> Linux is way too loose on default network configuration.
> 
> Dan the Man with Too Many "make test" For a Day
> 
> 


Reply via email to