Http requests do not work when wifi is toggled off and back on

OliverGartnerOliverGartner OliverUSMember
edited September 2016 in Xamarin.iOS

Hi everyone,

I have an unexpected issue with http requests and I am wondering if anyone has an idea what could be going on.

If I startup my app on an iPad or iPhone where wifi is off (no LTE is available), my http requests fail as expected. But when I then turn wifi on, they still fail. I have to restart the app to get my requests working again. I validated that other apps work fine after the wifi is toggled on to make sure that the internet connection is working.

I tried to reproduce the issue with one of the Xamarin samples (https://developer.xamarin.com/samples/monotouch/HttpClient/). Indeed I get the same issue here. I only modified the code slightly to allow for subsequent http requests after a failed one. I attached the modified version with my changes.

Is this a Xamarin bug or am I missing something?

Thanks,
Oliver

Steps to reproduce:

  • Run the attached version of the http sample app while your device has no internet connection (wifi toggled off)
  • Select "http - WebRequest" and submit a few requests by clicking "Issue Http request"
  • Observe in the console output that the http requests fail
  • Toggle the wifi on. Ensure internet connectivity.
  • Submit a few more http requests
  • Observe that all requests still fail. This is the issue. If the app is killed and then restarted, everything works again. So it looks like we get in a bad state and do not recover.
    (I tried this on an ipad and an iphone running ios9 and I am using Xamarin Studio 6.1)

Answers

Sign In or Register to comment.