I am using Sharppcap wrapper for WinPcap and I am trying to read multiple pcap files, consecutively, in one instance of a program/ program lifetime
foreach (FILENAME in LIST) // pseudocode
{
ICaptureDevice device;
try
{
device = new SharpPcap.LibPcap.CaptureFileReaderDevice(FILENAME);
device.Open();
}
catch (Exception e){}
while ((device.GetNextPacket()) != null)
{
// Handle Packet from FILENAME
}
device.Close()
}
It traverses the first file all right, but as soon as it tries parsing the second file, it throws an AccessViolationException.
I know I can have one instance of this program for 1 pcap file, but I would really like to handle all the files in one program. Any ideas?