Android‎ > ‎

Seting Connection Time Out Inteval : HttpClient Android

posted Feb 13, 2013, 1:22 AM by Akash Khaitan   [ updated Mar 9, 2013, 7:52 AM ]
public void executeHttpGet(String param_uri) throws Exception {
                BufferedReader in = null;
                try {
                    Log.e("Talk2Us","Creating an http request for"+param_uri);
                    HttpClient client = new DefaultHttpClient();
                    HttpGet request = new HttpGet();
                    request.setURI(new URI(param_uri));

                    //Setting Connection Time Out for HttpClient Request
                    HttpConnectionParams.setConnectionTimeout(client.getParams(), 5000);
                    HttpConnectionParams.setSoTimeout(client.getParams(), 5000);
                

                    HttpResponse response = client.execute(request);
                }
                catch(Exception e)
                {

                }
}


Comments