From: brandon on
On Jan 17, 10:34 am, brandon <brandon.mayfi...(a)att.net> wrote:
> On Jan 17, 10:06 am, xhos...(a)gmail.com wrote:
>
> > brandon <brandon.mayfi...(a)att.net> wrote:
>
> > >  So that is the behavior I think is inconsistent. Why would passing
> > > Timout result in EINVAL on AIX and HP boxes when an error is
> > > encountered in connect?
>
> > In a similar situation in the past, I made a IO::Socket::INET copy and
> > replaced the contents of _error with something that does a Carp::confess
> > instead.  That way you can get a back-trace of what is going on.
>
> > Xho
>
>  Sounds good. I think I'm going to see if I can find out if RH is
> changeing anything in IO::Socket, IO::Select, etc., when they build
> their perl distribution too. Always a possibility that they are making
> some changes that AIX for example is not. If I find anything
> interesting I'll let ya'll know.
>
>
>
> > --
> > --------------------http://NewsReader.Com/--------------------
> > The costs of publication of this article were defrayed in part by the
> > payment of page charges. This article must therefore be hereby marked
> > advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
> > this fact.- Hide quoted text -
>
> - Show quoted text -

For anyone that continued reading this - I've given up on trying to
use Timeout to limit the amount of time I wait for a sucessful connect
before giving up. I wanted to do that because this is only one of many
checks I need to do and some of these servers (Sun I think) are taking
3 minutes + to timeout.

So I got rid of the Timeout and just fork a child and kill it after
30 sec if there is no response. Works great and does what I need it to
do and the sysadmins won't forget what they were doing by the time the
whole program finishes.

Without Timeout I encountered a few old clients that would not return
a correct perror with $@ and a few old clients that would not return a
correct perror with $!. The vast majority return the same perror for
both $! and $@.

I can't update the version of Perl on these clients but I could haul
the modules .so's around with me, though I prefer not to do that. So I
finally settled on checking the perror (first $@, then if $@ is not a
socket perror I test $!), and printing my own error message. If I
don't recognize either as a socket perror I print a message to that
effect along with both $@ and $!. So far I have not hit that condition
and I've run this on a couple thousand servers.

Thanks to everyone including Uri.