Search code examples
c#network-programmingpcap.netsharppcap

How can I get the MAC/IP address of a packet device in pcap.net/SharpPcap?


I'm using the PacketDevice or LivePacketDevce in order to send and receive packets. I have 2 network interfaces that I have to use and I can't find an attribute of Packet Device that has it's MAC or IP address. It's a problem using the destination of incoming packets as I am relying on arp broadcasts. Is there any way to get the IP or MAC addresss of a packet device in pcap.net or using SharpPacap? thanks


Solution

  • ICaptureDevice.MacAddress should give you the adapter's mac address, so the MacAddress property of your live devices.