UINT CPublic::Cappacketlivethread(LPVOID pParam) {
struct pcap_pkthdr* header;/*資料包頭部資訊*/
const u_char* pkt_data;//資料
m_pacNum = 0;//捕獲包的個數
CFile m_file;
if (m_file.Open(_T("default.DAT"), CFile::modeRead, NULL)) //臨時檔案
{
m_file.Close();
m_file.Remove(_T("default.DAT"));
}
m_filepath = "default.DAT";
dumpfile = pcap_dump_open(adhandle,m_filepath);
int res = 0;
//當用戶按下開始按鈕,開始捕獲
while (res = (pcap_next_ex(adhandle, &header, &pkt_data)) >= 0 && isStart) {
if (res == 0)continue;
++m_pacNum;
pcap_dump((u_char*)dumpfile,header,pkt_data);
}
return 0;
}這是我的抓包執行緒。抓包開始時,res值為1,但是header和pkt_data顯示結果如下圖所示:

這是怎么回事?
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/73872.html
標籤:網絡編程
上一篇:哈希表程式運行問題?
下一篇:求高效讀取螢屏區域像素值完整代碼
