I am developing a call recording application in C#.net using pcap.net
library. For packet capturing i am using Wireshark's Dumpcap.exe
. And the packet files are creating in 5 second duration. To read each packet file what i have done is
OfflinePacketDevice selectedDevice = new OfflinePacketDevice(filename);
using (PacketCommunicator communicator =
selectedDevice.Open(65536, // portion of the packet to capture
// 65536 guarantees that the whole packet will be captured on all the link layers
PacketDeviceOpenAttributes.Promiscuous, // promiscuous mode
0)) // read timeout
{
communicator.ReceivePackets(0, DispatcherHandler);
In DispatcherHandler method i am processing each packets. DispatcherHandler call takes 0 seconds for each file .
I am getting delay when prcessing the RTP packets packets in the same method..
To identify rtp packets I used ordered dictionary with key as ipadrress+portnumber
. So I need to check whether this key exists in dictionary when each rtp packet comes. This task getting slower in processing each dump file.
if (objPortIPDict.Contains(ip.Source.ToString().Replace(".", "") + port))
{
// here i write the rtp payload to a file
}