问题:
1、在捕获数据时,随着时间推移,CPU负载逐渐变大,从而导致程序闪退。
优化:
1、过滤数据时,尽量条件限定严格。
char packet_filter[] = "ip and tcp and (dst port 20008 or src port 20008)";
2、通过超时时间调整符合设备性能的速率。
pcap_open_live(name.toLatin1().data(),
65535,
1,
100, // 读取超时时间
errbuf
) ) == NULL)
1088

被折叠的 条评论
为什么被折叠?



