Home > Software engineering >  Pcap_next_ex () returns the value of 1. But there is no data
Pcap_next_ex () returns the value of 1. But there is no data

Time:09-24

 UINT CPublic: : Cappacketlivethread (LPVOID pParam) {
Struct pcap_pkthdr * header; Packet header information/* */
Const u_char * pkt_data;//data
M_pacNum=0;//to capture the number of packages
CFile m_file;
If (m_file. Open (_T (" default. DAT "), CFile: : modeRead, NULL))//temporary files
{
M_file. Close ();
M_file. Remove (_T (" default. DAT "));
}
M_filepath="default. DAT";
Dumpfile=pcap_dump_open (adhandle m_filepath);
Int res=0;
//when the user press the start button and start to capture
While (res=(pcap_next_ex (adhandle, & amp; The header, & amp; Pkt_data) & gt;=0 & amp; & IsStart) {
If (res==0) continue;
+ + m_pacNum;
Pcap_dump ((u_char *) dumpfile, header, pkt_data);
}
return 0;
}

This is my caught threads, caught in the beginning, res value is 1, but the header and pkt_data display results as shown in the figure below:

This is how to return a responsibility?
  • Related