You will need to run pcap_loop () in separate threads, one for each interface, we do this and it works.
Some parts of libpcap are not thread safe, though, atleast pcap_setfilter (), so provide your own lock around this.
If you do not want to use streams, you will need to provide an event loop on your own, where you track the file descriptors of each device using select / poll or similar. You can get the file descriptor for the device descriptor using pcap_get_selectable_fd ().
source
share