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: Intermediate:
time out for a function

 



rameshgsl
New User

Feb 4, 2009, 4:09 AM

Post #1 of 3 (3118 views)
time out for a function Can't Post

Hi,
How can i add timeout for the following ?

my code capture the packets.

i am using Net::Pcap::open_live and Net::Pcap::loop.

But how can i specify a time out to the loop.

for example if there are no packets for a given time the function should exit.


FishMonger
Veteran / Moderator

Feb 4, 2009, 5:00 AM

Post #2 of 3 (3113 views)
Re: [rameshgsl] time out for a function [In reply to] Can't Post

perldoc -q timeout

Quote
Found in /usr/lib/perl5/5.10.0/pod/perlfaq8.pod
How do I timeout a slow event?

Use the alarm() function, probably in conjunction with a signal handler, as documented in "Signals" in perlipc and the section on "Signals" in the
Camel. You may instead use the more flexible Sys::AlarmCall module available from CPAN.

The alarm() function is not implemented on all versions of Windows. Check the documentation for your specific version of Perl.



d1zz13
User

Feb 5, 2009, 7:13 AM

Post #3 of 3 (3096 views)
Re: [rameshgsl] time out for a function [In reply to] Can't Post

The open_live function can have a timeout passed into it as an argument.

Regards
Rich

If it aint broke then don't try to fix it

 
 


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

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