public static ushort GetPacketId(byte[] buffer) { if (buffer.Length < 4) return 0; return BitConverter.ToUInt16(buffer, 2); }