Event to capture IP Packets
-
I am writing an application which captures IP packets from the default network interface. The original code uses hard coded data which does not allow it to be used by other programmers. I am attempting to rewrite the code to use an event which should be triggered every time a packet arrives however i am STUCK! The packet capture method, called Capture() stores each packet in a class called IPPacket I have a delegate declared as
public delegate void PacketArrival(object sender, IPPacket packet);
and an even declared aspublic event PacketArrival OnPacketArrival;
I do not know how to link the Capture() method to the delegate so that when the event is used, the capture method will notify the event each time a packet arrives Please help!!! -
I am writing an application which captures IP packets from the default network interface. The original code uses hard coded data which does not allow it to be used by other programmers. I am attempting to rewrite the code to use an event which should be triggered every time a packet arrives however i am STUCK! The packet capture method, called Capture() stores each packet in a class called IPPacket I have a delegate declared as
public delegate void PacketArrival(object sender, IPPacket packet);
and an even declared aspublic event PacketArrival OnPacketArrival;
I do not know how to link the Capture() method to the delegate so that when the event is used, the capture method will notify the event each time a packet arrives Please help!!!I've worked it out! :-) all working. The Capture() method captures a packet and fires an event. All event listeners are able to recieve the captured packet and perform some action on it.