Hi,

In my application i get response from web service and show its result
from resultant stream at activity, i get stream as

try
{
        String connectTo = webService + webServiceMethod + queryString;
        connectTo = connectTo.replaceAll(" ", "%20");
        URL url = new URL(connectTo);
        URLConnection ucon = url.openConnection();
        ucon.setConnectTimeout(15000);
        ucon.connect();
        InputStream is = ucon.getInputStream();
        BufferedInputStream bis = new BufferedInputStream(is);
        return bis;
}
catch (SocketTimeoutException e)
{
        throw e;
}
catch (MalformedURLException e)
{
        throw e;
}
catch (IOException e)
{
        throw e;
}


If emulator/device is connected with internet then this code work fine
but if i disconnect internet and try to connect any URL then it keep
continue to wait even few minutes, however i set connection timeout 15
seconds. This feel really bad. I want a smart solution, if internet is
down or disconnected this code will throw SocketTimeOut exception or
notify me AFTER 15 seconds that net is down.

Ali Adnan.

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to