I'm using the lib SharpPCap to capture packets, then analyse them to find the flv video address in PacketArrivalEventHandler function. The main part of class is like this:
class addrdetector
{
private LivePCapDevice device;
private device_OnPacketArrival(object sender, CaptureEventArgs e)
{
/* some analysis and some output */
if (match)
{
device.StopCapture();
device.Close();
}
}
public Analyse()
{
var devices = LivePcapDeviceList.Instance;
device = devices[2];
device.OnPacketArrival +=
new PacketArrivalEventHandler(device_OnPacketArrival);
device.Open();
device.StartCapture();
}
}
if I have 2 instances of addrdector in a program, the first instance has the correct output, but the second hasn't any output. It seems like the second can't capture any packet.
I've tested 2 instances of LivePCapDevice in a same main funcion, and they work correctly. They can also work in 2 EXE.s. But I can't find out why they conflict in a program...
Thanks~