[Winpcap-users] Unexpected behaviour

Geir . vga_planets at hotmail.com
Tue Feb 7 21:11:15 GMT 2006


Hello guys

I'm working on an application that sometimes gives me unexpected behaviour 
which I don't understand, or why it happends.

Since I don't know why it happends, it's a little difficult to reproduce

but look at this error message returned by pcap

Cannot determine the network type: The operation completed successfully. (0)

why does this happend?

Here is the code I call in my c program:

on program startup, I read the network adapters (pcap_findalldevs), make a 
decition on which card I want to use, and copy the name property of that 
card to my devName.

devName is a char* pointer.

this is a multithreaded program

each thread use this code:

int snaplen = 100;
char    error[PCAP_ERRBUF_SIZE];
pcap_t *pcapHandle = NULL;

pcapHandle = pcap_open_live(devName, snaplen, 0, 500, error);

they share the pointer devName, which is never changed, only read by several 
threads

sometimes the above call returns a null pointer, and I immediately print out 
the error message stored in error which is:

Cannot determine the network type: The operation completed successfully. (0)

so, can you gurus maybe tell me why pcap_open_live sometimes returns a null 
pointer and the error message specified above?

WinPcap version 3.1 (packet.dll version 3, 1, 0, 27), based on libpcap 
version 0.9[.x]
this program was compiled and tested on win XP, w/service pack 2
if you want to know, the network adapter is a Realtek RTL8139 Family Fast 
Ethernet Adapter (Microsoft's Packet Scheduler)

(at least thats the information pcap gives as description on my adapter)

I do not use a lock on pcap_open_live open, or pcap_close calls, but most of 
the others (i.e. those compile filter and set filter and pcap_findalldevs 
etc, I use mutex_locks to insure no concurrent calls)

Hope this message isnt too confusing. :)

Cheers vga.




More information about the Winpcap-users mailing list