获取pcap文件的第一个数据包 [英] get the first packet of pcap file
本文介绍了获取pcap文件的第一个数据包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在编写扫描pcap文件包的代码。
我使用命令
$
有没有办法获得第一个数据包 - 在代码的中间某处,没有关闭并重新打开pcap文件?
解决方案您可以使用
= ftell(pcap_file(p));在第一个
pcap_next_ex()
之前的
<fseek(pcap_file(p),pos,SEEK_SET);
当您想再次获取第一个数据包时。
I am writing code that scan the packets of pcap file.
I use the command
pcap_next_ex()
to get the next packet.
is there a way to get the first packet- somewhere in the middle of the code, without close and reopen the pcap file?
Thanks.
解决方案You can use
long pos = ftell(pcap_file(p));
before the first
pcap_next_ex()
, andfseek(pcap_file(p), pos, SEEK_SET);
when you want to get the first packet again.
这篇关于获取pcap文件的第一个数据包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文