I'm using the libpcap library to sniff packets on an interface. (My target OS is Linux, but I don't think that helps here.)
I'm using pcap_loop() to capture packets, but pcap_loop() waits until a packet is captured before returning to the calling function. Is there any way to force it to only listen for a specified amount of time? I'd like to loop the main program while just checking each loop for new packets, rather than having to wait for a new packet to arrive before doing anything. I've looked around and am pretty sure there's no built-in feature for this (that works on Linux) so might there exist some type of work-around?