----- Original Message ----- From: "Bennett Haselton" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, August 20, 2004 14:52 Subject: how to do a timeout of accept() in ActivePerl
> However, I'm trying to do something similar in ActivePerl (v5.8.3 build > 809) but the ActivePerl-Winfaq5.html file says that the alarm() function is > not implemented in ActivePerl. So is there a way in ActivePerl to force a > block of code to time out after a certain number of seconds? This is the > code that I'm trying to make time out: > > my $server = IO::Socket::INET->new( Proto => 'tcp', > LocalPort => $PORT, > Listen => SOMAXCONN, > Reuse => 1); > $server->accept(); > > I tried seeing if the accept() function had its own timeout that I could > use -- this is what the documentation says: > > >>> > accept([PKG]) Bennett, I do soemthing similar by specifying the Timeout parameter like this: my $Socket = IO::Socket::INET->new(LocalHost => $SocketServer, Listen => 5, LocalPort => $Port, Proto => 'tcp', Reuse => 1, Timeout => $Interval); The value of the variable I am using, i.e. $Interval, can be set to whatever you desire, it represents the number of seconds that the socket will listen for a connection. Dirk Bremer - Systems Programmer II - ESS/AMS - NISC St. Peters USA Central Time Zone 636-922-9158 ext. 8652 fax 636-447-4471 [EMAIL PROTECTED] www.nisc.cc _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs