数据截取 如何截取数据包?
如何截取数据包?要截获数据包,我们可以使用Libpcap函数库:在用Libpcap开发网络嗅探器时,一般包括以下基本过程:1)确定捕获网络数据包的网卡。函数原语:char*pcapulookupdev
如何截取数据包?
要截获数据包,我们可以使用Libpcap函数库:在用Libpcap开发网络嗅探器时,一般包括以下基本过程:
1)确定捕获网络数据包的网卡。函数原语:char*pcapulookupdev(DEV*errbuf)
2)打开网络设备。功能原型:pcap_ut*pcap_uuuu打开uuulive(constchar*device,intsnaplen,intpromisc,intto_uums,char*errbuf)3)。函数原语:intpcap compile(pcap t*p,structbpf program*fp,char*str,intoptimize,bpf u Int32netmask)4)。函数原语:constu char*pcap next(pcap t*p,structpcap 5)关闭网络设备。函数原型:void pcapuuclose(pcaput*p)