From 4de2aa91f915188547ca840789926a5e70b32b45 Mon Sep 17 00:00:00 2001 From: Alex Stangl <67007903+AlexStanglEmerson@users.noreply.github.com> Date: Tue, 17 Nov 2020 12:13:26 -0600 Subject: [PATCH] Fixed connectionSize Limit For the T_O_Length, values were limited to 255 due to the byte typecast. However, the connection size parameter is 9 bits long, so the conversion was changed to a UInt16 which also matches the connectionSize variable's datatype. --- EEIP.NET/EIPClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EEIP.NET/EIPClient.cs b/EEIP.NET/EIPClient.cs index cd8962c..eef0dba 100644 --- a/EEIP.NET/EIPClient.cs +++ b/EEIP.NET/EIPClient.cs @@ -435,7 +435,7 @@ public void ForwardOpen(bool largeForwardOpen) connectionType = (byte)T_O_ConnectionType; //1=Multicast, 2=P2P priority = (byte)T_O_Priority; variableLength = T_O_VariableLength; - connectionSize = (byte)(T_O_Length + t_o_headerOffset); + connectionSize = Convert.ToUInt16(T_O_Length + t_o_headerOffset); NetworkConnectionParameters = (UInt16)((UInt16)(connectionSize & 0x1FF) | ((Convert.ToUInt16(variableLength)) << 9) | ((priority & 0x03) << 10) | ((connectionType & 0x03) << 13) | ((Convert.ToUInt16(redundantOwner)) << 15)); if (largeForwardOpen) NetworkConnectionParameters = (UInt32)((uint)(connectionSize & 0xFFFF) | ((Convert.ToUInt32(variableLength)) << 25) | (uint)((priority & 0x03) << 26) | (uint)((connectionType & 0x03) << 29) | ((Convert.ToUInt32(redundantOwner)) << 31));