Clear questions and runnable code
get the best and fastest answer
Timeout problem using IO::Socketby ChOas (Curate)
|on Sep 27, 2000 at 13:35 UTC||Need Help??|
ChOas has asked for the
wisdom of the Perl Monks concerning the following question:
You know you've been programming to long when your debugging lines contain swear words
I use IO::Socket to create a new socket, which connects
to a certain port on a host...
I'm not sure if this is a valid host, so, I would like
to set up an alarm handler to stop the Socket from trying
after a few seconds....
Alarm handler set up, I set my alarm for 3 secs.
my $Socket=IO::Socket::INET->new("$Host:$Port") or return(1,"Error setting up connection");
(Just to clear this up, the code in my alarm handler has
been varied from setting an Errorflag, to exiting and to
printing some VERY rude words....
My program runs ($Host=127.0.0.2 so, nonexistant)
and exits after my alarm time with "Alarm Clock" on STDERR
Just to inform you: *I* did NOT print that anywhere...
Things I tried:
I'd like to put it this way: Help me please!