public static void sendPacket(Packet packet, Stream stream) { stream.WriteByte(packet.getIDbytes()); stream.Write(packet.getDataLengthBytes(), 0, sizeof(int)); if (packet.byteDataLength > 0) { stream.Write(packet.byteData, 0, packet.byteDataLength); } }