try
{
var packet = Packet.ParsePacket(e.GetPacket().LinkLayerType, e.GetPacket().Data).Extract();
if (packet != null && (packet.SourcePort == 7656 || packet.DestinationPort == 7656))
{
Console.WriteLine("packet: " + packet.PayloadData.Length);
_receiver.ReceivePacket(packet.PayloadData);
}
}
catch (Exception exc)
{
ConsoleManager.WriteLineForError(MethodBase.GetCurrentMethod()?.DeclaringType, exc);
Log.Error(nameof(Device_OnPacketArrival), exc);
}
I've printed the lengths of the packet.PayloadData. This is the prints.
packet: 58
Exception thrown: 'System.IndexOutOfRangeException' in PhotonPackageParser.dll
packet: 44
Exception thrown: 'System.IndexOutOfRangeException' in PhotonPackageParser.dll
packet: 236
Why is it throwing this exception?