ghee2ghee has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks, I have a worrying problem I cannot explain. I'm trying to use Net::SMTP to send mail (which uses IO::Socket::INET). On most platforms, I have no problems at all. However, on one (SCO Openserver 5.0.4), I can only connect to the SMTP server if I specify a timeout of 0 - all other values cause the connect to fail immediatley. I've isolated the issue to IO::Socket::INET (it isn't Net::SMTP). A colleague seems to think that it's because the connection is somehow created differently if a zero timeout is specified - but I'm not convinced. I've seen a similar issue reported here, but it was not resolved. I'd like to know why only a zero timeout works. What do I do if I need a proper timeout? I can't send out live code knowing that there is a potential support issue. Could anyone elighten me?
  • Comment on IO::Socket::INET timeout setting - only 0 works

Replies are listed 'Best First'.
Re: IO::Socket::INET timeout setting - only 0 works
by Animator (Hermit) on May 03, 2005 at 13:49 UTC

    I have no idea why it doesn't work, or why it only works if you set a timeout to 0, but you can always use alarm yourself (and put your code (the connect) in an eval block etc)... (`perldoc -f alarm`)

Re: IO::Socket::INET timeout setting - only 0 works
by gellyfish (Monsignor) on May 03, 2005 at 14:06 UTC

    You might get more information if you print out the value of $! if the connection fails, but this sounds like an OS 'feature', you might want to check here to see if there is anything that fixes it.

    /J\