Hi, I am using openConnection() of URLConnection to get a connection to a server. If the IP address provided is not leased in the network, then it waits until the java throuws the timeout after 30 to 40 seconds. How can I interrupt or set timeout for the openConnection() API. I tried with calling the API with a separate thread and then kill the thread whenever I want. But it did not work. Please help me. Thanks in advance.