Replies: 4 comments 7 replies
-
|
Beta Was this translation helpful? Give feedback.
-
I can't attach pcap file here |
Beta Was this translation helpful? Give feedback.
-
ok here the file Thanks |
Beta Was this translation helpful? Give feedback.
-
you said : "the code provided is missing the line where the reader is created/file name provided" because i did before : |
Beta Was this translation helpful? Give feedback.
-
I can write my captures to a file with the CaptureFileWriterDevice class. However, I'm trying to read these .pcap files. I see examples with the CaptureFileReaderDevice class. I tried this, but I got an error:
SharpPcap.PcapException*: 'Unable to open offline adapter: ' on the line
captureFileReader.Open();
private static void device_OnPacketArrival(object sender, PacketCapture e)
string path = "C:\\Users\\Documents\\Captures.pcap";
CaptureFileReaderDevice captureFileReader = new CaptureFileReaderDevice(path);
int packetsRead = 0;
GetPacketStatus retval;
while (packetsRead < packetsToRead)
{
captureFileReader.Open();
do
{
retval = captureFileReader.GetNextPacket(out e);
if (retval == GetPacketStatus.PacketRead) packetsRead++;
}
while (retval == GetPacketStatus.PacketRead);
}
var endTime = DateTime.Now;
Console.WriteLine(endTime);
}
Beta Was this translation helpful? Give feedback.
All reactions