public byte[] Data; //VARIABLE public CommMessage(String sourceIP, UInt16 messageCommand, Boolean isBinary, String componentName, string dataTimestamp, UInt32 dataSize, byte[] data) { SourceIp = ByteOperations.EncodeStringNumberToByteArray(sourceIP); MessageCommand = new byte[2]; IsBinary = new byte(); ComponentName = new byte[8]; DataTimestamp = new byte[9]; DataSize = new byte[4]; Data = new byte[0]; MessageCommand = BitConverter.GetBytes(messageCommand); IsBinary = Convert.ToByte(isBinary); if (componentName.Length > 8) { componentName = componentName.Substring(0, 8); } else { componentName = componentName.PadRight(8, ' '); } ComponentName = Encoding.Unicode.GetBytes(componentName); DataTimestamp = ByteOperations.EncodeStringNumberToByteArray(dataTimestamp); DataSize = BitConverter.GetBytes(dataSize); Data = new byte[dataSize]; data.CopyTo(Data, 0); }