public static Packet readIn(DataInputStream in) throws IOException,
			ClassNotFoundException {
		// Read messagetype
		int packetType = -1;
		do {
			packetType = in.read();
		} while (packetType == -1);

		int intData = 0;
		String strData = "";
		long longData = 0;

		// The range specifies parameter type
		if (packetType >= INT_LOWER && packetType <= INT_UPPER) {
			intData = in.readInt();
			// Return new packet
			return new Packet(packetType, intData);
		} else if (packetType >= STR_LOWER && packetType <= STR_UPPER) {
			strData = in.readUTF();
			// Return new packet
			return new Packet(packetType, strData);
		} else if (packetType >= LONG_LOWER && packetType <= LONG_UPPER) {
			longData = in.readLong();
			// Return new packet
			return new Packet(packetType, longData);
		} else {
			// Return new packet
			return new Packet(packetType);
		}

	}