CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
timeout for accept

 



Omicron
Deleted

Nov 14, 2000, 9:48 PM

Post #1 of 2 (716 views)
timeout for accept Can't Post

After I run an accept I want to come out after 3 seconds. Now I need something like a timeout for accept. My code:
$newchecksock=$checksock->accept();
while (defined($buf=<$newchecksock> ))
{
chomp($buf);
if($buf eq "ok")
{
print"everything's ok, Port $portonclient[$i] is open!\n";
}
}

How can I create a timeout for this ?
Please help !
Thanks a lot, Holger.


long_beach_john
Deleted

Dec 7, 2000, 11:21 PM

Post #2 of 2 (716 views)
Re: timeout for accept [In reply to] Can't Post

on unix try:
my ($wait_time)=3;
$SIG{'ALRT'}=sub
{die "timeout}

alert($wait_time);
eval
{
#waiting 3 seconds
};
alert (0);
if ($@=~/timeout/)
{
#looser
}else
{
#winner
};

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives