UINT CNILayer::ReadingThread(LPVOID pParam) { //////////////////////// fill the blank /////////////////////////////// struct pcap_pkthdr* header; const u_char* pkt_data; int result; AfxBeginThread(FileTransferThread, (LPVOID)pParam); CNILayer* pNI = (CNILayer*) pParam; while(pNI->m_thrdSwitch) { result = pcap_next_ex(pNI->m_AdapterObject,&header,&pkt_data); if(result == 0) { } else if(result == 1) { pNI->Receive((u_char*)pkt_data); } else if(result < 0) {} } return 0; /////////////////////////////////////////////////////////////////////// }
UINT CNILayer::ReadingThread(LPVOID pParam) { struct pcap_pkthdr *header; const u_char *pkt_data; int result; CNILayer *pNI = (CNILayer *)pParam; while(pNI->m_thrdSwitch) // 패킷 체크 { // 패킷 읽어오기 result = pcap_next_ex(pNI->m_AdapterObject,&header,&pkt_data); if(result==0){ // AfxMessageBox("패킷 없음"); } else if(result==1){ // AfxMessageBox("패킷 있음"); pNI->Receive((u_char *)pkt_data); } else if(result<0){ // AfxMessageBox("패킷 오류"); } } return 0; }