You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Request never timeouts on Android (when there is established connection and timeout is due to external server responding slow , socket-like timeout).
Reason:
OkHttpClient.SetConnectionTimeout, ReadTimeout, WriteTimeout is not used, default value of 0 means: NO TIMEOUT.
I found with my own project that changing the OkHttpNetworkHandler to set the timeouts for the OkHttpClient to 0 (which signifies infinite), then checking the IOException for if the task was cancelled seems to be a cleaner approach.
This lets the HttpClientHandler use the cancellation token, which gets cancelled on the C# HttpClient after the timeout finishes.
Less hassle, no extra properties, works fairly well.
I am having this issue right now. I have an endpoint that takes a while so i set a 30 seconds timeout but the call timeouts before the 30 seconds, any idea?
@lhaussknecht Sure it is. As opposed to the iOS projects it is not available in GUI settings. I have asked Miguel de Icaza about that - he said GUI option will be available in future (in next releases) as Android team hit release deadline. You can set it manually in code:
var client = new HttpClient (
new Xamarin.Android.Net.AndroidClientHandler ());
or using @(AndroidEnvironment) build action:
XA_HTTP_CLIENT_HANDLER_TYPE=Xamarin.Android.Net.AndroidClientHandler
I am having kinda the same issue, timeout settings above 49 milliseconds will be ignored and the HttpClient will use the default timeout. Though, no problems on iOS.
Hi, I'm having the same issue. I'm trying to check for server availability and I set the timeout property on the HttpClient to 2 seconds but it takes over a minute to timeout. Is there a fix for this?
Activity
thefex commentedon Nov 9, 2015
Fixed
Making pull request ( I updated ilbs to v2.5 too )
Please take care of iOS separetely.
Merge pull request anaisbetts#193 from thefex/master
adammeaney commentedon Jan 22, 2016
I found with my own project that changing the OkHttpNetworkHandler to set the timeouts for the OkHttpClient to 0 (which signifies infinite), then checking the IOException for if the task was cancelled seems to be a cleaner approach.
This lets the HttpClientHandler use the cancellation token, which gets cancelled on the C# HttpClient after the timeout finishes.
Less hassle, no extra properties, works fairly well.
alexrainman commentedon Apr 25, 2016
I am having this issue right now. I have an endpoint that takes a while so i set a 30 seconds timeout but the call timeouts before the 30 seconds, any idea?
thefex commentedon May 26, 2016
@robertbaker I don't use ModernHttpClient anymore. I use new Xamarin HTTP stack implementation.
lhaussknecht commentedon Jun 29, 2016
@thefex Is the Xamarin HTTP stack available in Android projects?
thefex commentedon Jun 29, 2016
@lhaussknecht Sure it is. As opposed to the iOS projects it is not available in GUI settings. I have asked Miguel de Icaza about that - he said GUI option will be available in future (in next releases) as Android team hit release deadline. You can set it manually in code:
var client = new HttpClient (
new Xamarin.Android.Net.AndroidClientHandler ());
or using @(AndroidEnvironment) build action:
XA_HTTP_CLIENT_HANDLER_TYPE=Xamarin.Android.Net.AndroidClientHandler
rubit0 commentedon Jan 22, 2017
I am having kinda the same issue, timeout settings above 49 milliseconds will be ignored and the HttpClient will use the default timeout. Though, no problems on iOS.
zeezment commentedon Dec 6, 2017
Hi, I'm having the same issue. I'm trying to check for server availability and I set the timeout property on the HttpClient to 2 seconds but it takes over a minute to timeout. Is there a fix for this?
alexrainman commentedon Dec 6, 2017
I released a new version of the plugin that fix this issue. I am planning to do more. Search for modernhttpclient-updated.