Foxman
Foxman

Reputation: 189

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

Upvotes: 1

Views: 2033

Answers (2)

brickner
brickner

Reputation: 6585

In Pcap.Net, there's an extension method for this:

public static MacAddress GetMacAddress(this LivePacketDevice livePacketDevice)

Upvotes: 0

Chris Morgan
Chris Morgan

Reputation: 1339

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

Upvotes: 1

Related Questions