On May 29, 2:40 pm, [EMAIL PROTECTED] (Zentara) wrote:
> On 28 May 2007 08:28:35 -0700, [EMAIL PROTECTED] (kenTk) wrote:
>
>
>
> >If there is no server or no connection this hangs for about 20 seconds
> >and then crashes with the following error message.
> >The Timeout seems to make no difference and the 'warn' does not occur.
> >If works file with a good connection to a server.
> >Using 5.8.8 active perl.
> >Anyone got any suggestions for making it return undef in an orderly
> >fashion?
> >(I have tested it on Linux and it seems to work fine both ways)
>
> >use strict;
> >use warnings;
> >use IO::Socket::INET;
>
> >sub testSocket
> >{
> >  my $sock;
> >  my $ok=0;
> >  unless( $sock=IO::Socket::INET->new(192.168.5.41,
> >                                 PeerPort => '21',
> >                                 Proto    => 'tcp',
> >                                 Timeout  =>'3'))
>
> are you sure that '21' and  '3' should be quoted?
> Maybe Perl figures it's context and does the right thing on linux?
>
> >  {  warn 'Cant connect'; }
> >  else
> >  { $sock->close;  $ok=1; }
> > return $ok;
> >}
>
> I don't use win32, but have seen these somewhat related 
> posts:http://perlmonks.org?node_id=567912
>
> http://perlmonks.org?node_id=529812
>
> zentara
>
I tried removing the quotes around 21 and 3 but with no success.
I have already tried the ioctl fix for non-blocking on windoze but to
no avail. I believe that only applies to a new socket object after it
has been created. In this case that creation process fails with a
crash and doesnt return in an orderly fashion. I wish that I didn't
have to use windoze but ..............


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to