Hello, I'm new to winpcap, and right now I ran into a problem concerning capturing from multiple devices. I tried to solve this without using multiple threads. I supposed that when the 'WaitForMultipleObjects' releases my thread, at least one packet is ready to be read by 'pcap_next_ex'. However, my experience shows, that it works for a while, but after a few dozen packets 'pcap_next_ex' returns with timeout (0). Is it a bug, or I may have misunderstood something ?
Thanks, Peter ----- 8>< ----- 8>< ----- 8>< ----- 8>< ----- 8>< ----- 8>< ----- 8>< ----- #define WPCAP #include <pcap-int.h> int main() { char errbuf[PCAP_ERRBUF_SIZE]; char *dev = pcap_lookupdev(errbuf); if (!dev) { printf("pcap_lookupdev(): %s\n", errbuf); exit(1); } bpf_u_int32 net, mask; if (pcap_lookupnet(dev, &net, &mask, errbuf) != 0) { printf("pcap_lookupnet(): %s\n", errbuf); exit(1); } pcap_t* descr = pcap_open_live(dev,65535,1,1000,errbuf); if (descr == NULL) { printf("pcap_open_live(): %s\n", errbuf); exit(1); } pcap_pkthdr *header; const u_char *packetData; HANDLE handleArray[ 1 ]; handleArray[ 0 ] = pcap_getevent( descr ); do { // int sysCallRetVal = WaitForMultipleObjects( 1, handleArray, false, 500 ); int sysCallRetVal = WaitForSingleObject( handleArray[ 0 ], 500 ); if ( sysCallRetVal == WAIT_TIMEOUT ) printf( "!!!!!! WAIT_TIMEOUT !!!!!!!!\n" ); else if ( sysCallRetVal == WAIT_OBJECT_0 ) { printf( "!!!!!! PACKET !!!!!!!!\n" ); int res = pcap_next_ex( descr, &header, &packetData ); printf("pcap_next_ex %d\n", res ); if ( res == 0 ) exit( 1 ); } } while ( 1 ); return 0; } ================================================================== This is the WinPcap users list. It is archived at http://www.mail-archive.com/winpcap-users@winpcap.polito.it/ To unsubscribe use mailto: [EMAIL PROTECTED] ==================================================================