public static String readDomainName(DataInputStream dis, byte firstCount) throws Exception {
		StringBuffer strBuf = new StringBuffer();
		while (true) {
			// read character count
			byte count = 0;
			if (firstCount != 0) {
				count = firstCount;
				firstCount = 0;
			} else 
				count = dis.readByte();
			
			if (count == 0)
				break;
			if (strBuf.length() > 0)
				strBuf.append('.');
			while (count-- > 0) {
				byte c = dis.readByte();
				strBuf.append((char)c);
			}
		}
		return strBuf.toString();
	}