Forum Xamarin.Android

Setting connection timeout for AndroidHttpClient

Chris.3704Chris.3704 USUniversity ✭✭


I'm trying to implement AndroidHttpClient and think I have the right way of setting the connection timeout. However, the request is still using the default timeout of 60 seconds.

Any ideas?

            var client = AndroidHttpClient.NewInstance ("AppConnectClient");
            int sTimeout = 10;

                // Configure Timeout
                BasicHttpParams httpParameters = new BasicHttpParams();
                HttpConnectionParams.SetConnectionTimeout(httpParameters, sTimeout * 1000);
                HttpConnectionParams.SetSoTimeout(httpParameters, sTimeout * 1000);

                HttpGet get = new HttpGet(url);
                get.Params = httpParameters;

                var responseTask = client.ExecuteAsync(get);
Sign In or Register to comment.