Time Consuming to occur error when not able to reach the URL
<p>I have connected to my web service hosted in remote machine using ksoap protocl.But when connection to that url is not reachable it took time to occur exception.Is there any way to set timeout for making a connection in the ksoap.</p>

<p>The code i have written is given below.</p>

<pre><code>String SOAP_ACTION = "http://VisionEPODWebService/GetProblemAndReasonCodesNew";
        String OPERATION_NAME = "GetProblemAndReasonCodesNew";
        String WSDL_TARGET_NAMESPACE = "http://VisionEPODWebService/";
        String SOAP_ADDRESS = "";

        SOAP_ADDRESS = "http://" + serverIPAddress
                + "/VisionEPODWebService/SystemData.asmx";
        SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,
                OPERATION_NAME);
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                SoapEnvelope.VER10);
        request.addProperty("deviceID", deviceId);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(request);      
        HttpTransportSE httpTransport = new HttpTransportSE(SOAP_ADDRESS);
httpTransport.call(SOAP_ACTION, envelope);
            Object response = envelope.getResponse();
</code></pre>

<p>But I found a method for checking this by as given below</p>

<pre><code>if (InetAddress.getByName(server1IPAddress)
                                .isReachable(1000) == false) {
                            Exception exception = null;
                            throw exception;
                        }
</code></pre>

<p>But it shows error(UnknownHostException) when we specify port number along with the IP address.</p>

<p>Will anyone help me.
I need either to set time out for the above method or need to check IP reachable along with port number.</p>
