public InetAddress discoverHost (int udpPort, int timeoutMillis) {
		DatagramSocket socket = null;
		try {
			socket = new DatagramSocket();
			broadcast(udpPort, socket);
			socket.setSoTimeout(timeoutMillis);
			DatagramPacket packet = discoveryHandler.onRequestNewDatagramPacket();
			try {
				socket.receive(packet);
			} catch (SocketTimeoutException ex) {
				if (INFO) info("kryonet", "Host discovery timed out.");
				return null;
			}
			if (INFO) info("kryonet", "Discovered server: " + packet.getAddress());
			discoveryHandler.onDiscoveredHost(packet, getKryo());
			return packet.getAddress();
		} catch (IOException ex) {
			if (ERROR) error("kryonet", "Host discovery failed.", ex);
			return null;
		} finally {
			if (socket != null) socket.close();
			discoveryHandler.onFinally();
		}
	}