|
Hi,
Thank you for pcapDotNet it is life saver :).My question is that I get "Index was outside the bounds of the array." exception when I try to get SourceAddress field.
at PcapDotNet.Packets.ByteArrayExtensions.ReadInt(Byte[] buffer, Int32 offset) in C:\Users\Boaz\TFS\tfs06.codeplex.com\PcapDotNet\PcapDotNet\src\PcapDotNet.Packets\ByteArrayExtensions.cs:line 830 at PcapDotNet.Packets.ByteArrayExtensions.ReadInt(Byte[]
buffer, Int32 offset, Endianity endianity) in C:\Users\Boaz\TFS\tfs06.codeplex.com\PcapDotNet\PcapDotNet\src\PcapDotNet.Packets\ByteArrayExtensions.cs:line 257 at PcapDotNet.Packets.ByteArrayExtensions.ReadUInt(Byte[] buffer, Int32 offset, Endianity
endianity) in C:\Users\Boaz\TFS\tfs06.codeplex.com\PcapDotNet\PcapDotNet\src\PcapDotNet.Packets\ByteArrayExtensions.cs:line 273 at PcapDotNet.Packets.ByteArrayExtensions.ReadIpV4Address(Byte[] buffer, Int32 offset, Endianity endianity) in C:\Users\Boaz\TFS\tfs06.codeplex.com\PcapDotNet\PcapDotNet\src\PcapDotNet.Packets\ByteArrayExtensions.cs:line
382 at PcapDotNet.Packets.Datagram.ReadIpV4Address(Int32 offset, Endianity endianity) in C:\Users\Boaz\TFS\tfs06.codeplex.com\PcapDotNet\PcapDotNet\src\PcapDotNet.Packets\Datagram.cs:line 272 at PcapDotNet.Packets.Igmp.IgmpGroupRecordDatagram.get_SourceAddresses()
in C:\Users\Boaz\TFS\tfs06.codeplex.com\PcapDotNet\PcapDotNet\src\PcapDotNet.Packets\Igmp\IgmpGroupRecordDatagram.cs:line 99
I am using http://wiki.wireshark.org/SampleCaptures?action=AttachFile&do=view&target=IGMP+dataset.pcap pcap file. Since it could
be my fault of being inexperienced. I give you my code too; For some packet I get this exception at if(rec.AuxiliaryData!=null) and for some packet I get this exception at rec.SourceAddresses
foreach (PcapDotNet.Packets.Igmp.IgmpGroupRecordDatagram rec in dtg.GroupRecords)
{
if(rec.AuxiliaryData!=null)
memoExE_igmp_GroupRecords.Text +="Aux:"+ rec.AuxiliaryData+"\n " ;
if (rec.AuxiliaryDataLength != null)
memoExE_igmp_GroupRecords.Text +="AuxDL:"+ rec.AuxiliaryDataLength + "\n";
if(rec.MulticastAddress!=null)
memoExE_igmp_GroupRecords.Text +="MC Address:"+rec.MulticastAddress + "\n";
if (rec.NumberOfSources != null)
memoExE_igmp_GroupRecords.Text +="NumOfSources:"+ rec.NumberOfSources + "\n ";
if(rec.RecordType!=null)
memoExE_igmp_GroupRecords.Text +="RecType:"+ rec.RecordType + "\n ";
foreach(PcapDotNet.Packets.IpV4.IpV4Address address in
rec.SourceAddresses)
memoExE_igmp_GroupRecords.Text += address.ToString()+"\n";
}
Thank you for your time.
M. Emre Çolak
|