为了使用pcap从多个接口进行数据嗅探,我会按照以下伪代码操作:
这个足够了,还是有一些特别的注意事项需要考虑吗?
foreach interface:
open a file descriptor using pcap_open_live()
set the file descriptor to non-blocking
while true:
check for a ready file descriptor using select() or an equivalent I/O multiplexer
read data from every ready file descriptor using pcap_dispatch()
handle EndOfStream or Errors and break out of loop if needed
这个足够了,还是有一些特别的注意事项需要考虑吗?