Capturing the packets

Feb 24, 2012 at 11:00 AM

Hello, I just discovered your library, she looks powerful.

I need to capture packets and store the appropriate Mac and Ip address how this can be most easily done ?  Do I need a filter?

private void PacketHandler(Packet packet) // Callback function
{
EthernetDatagram e = packet.Ethernet;
IpV4Datagram ip = packet.Ethernet.IpV4;
string res = ("Source IP: " + ip.Source + " Dectination IP: " + ip.Destination);
string res1 = ("Source Mac: " + e.Source + " Destination Mac: " + e.Destination);
}

Thank you.

Coordinator
Feb 25, 2012 at 10:23 AM

Hi AlexanderN,

 

You only need the filter if you want to capture only some of the packets and not all of them.

Your code looks correct to me.

 

Boaz.

Feb 25, 2012 at 11:13 AM

 

Thank you.