alexrainman / ModernHttpClient

ModernHttpClient
MIT License
126 stars 27 forks source link

Java.Net.SocketTimeoutException in 10 sec in Android. #51

Closed KaranRami closed 4 years ago

KaranRami commented 4 years ago

When making API call with Singleton Instance of HttpClient in android, i am getting Java.Net.SocketTimeoutException in 10 sec.

ModernHttpClient: 3.3.2 & 3.3.4 Xamarin.Forms: 4.1.0.618606 VS 2017

To Reproduce issue:

  1. Use Singleton Instance of HttpClient.
  2. Make API which takes more than 10 sec.

Make two calls to API, second call will result in timeout exception in 10 sec.

alexrainman commented 4 years ago

Are you setting the Timeout property?

KaranRami commented 4 years ago

i have tried both with timeout and without timeout. it is happening in both scenarios.

Timeout = new TimeSpan(0, 0, 30) and also tried removing this property.

KaranRami commented 4 years ago

Hello @alexrainman ,

Is there any workaround for this, So i can continue with my App update?

KaranRami commented 4 years ago

After reading and debugging your code, i solved my issue by setting TimeOut property of NativeMessageHandler object. And now it is taking care of TimeOut.