Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Ethereal-dev: [Ethereal-dev] pcap_lookupdev of WinPCap question

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Nuno Magalhaes" <nunommagalhaes@xxxxxxxxxxx>
Date: Sat, 29 Oct 2005 19:55:22 +0100
How does ethereal retrieves all network adapter interfaces using pcap_lookupdev?

This function will only retrieve me the string: \Device\NPF_GenericNdisWanAdapter but this interface gets nothing... only my realtek interface gets the packets.

I'm using C#... if there is some sample code on how to get the name and use pcap_open_live on my realtek device I would be fully appreciated.

Thank you very much,
Nuno Magalhaes.

---C# Source code-------------------------------------------
//Get default adapter name
StringBuilder errbuf=new StringBuilder(PCAP_ERRBUF_SIZE);
IntPtr pDev=pcap_lookupdev(errbuf);
string dev=Marshal.PtrToStringUni(pDev);
MessageBox.Show(dev);
//Open device
if(pcap_open_live(dev/*"\\Device\\NPF_GenericNdisWanAdapter"*/,65536,1,1000,errbuf)==IntPtr.Zero)MessageBox.Show("Error!");