Hi I've first noted this when doing long polls in my app. Since then I've written a simple repro server (http://sdrv.ms/11DEYF2) and client (http://sdrv.ms/11DF6nZ) which allows you to define a timeout and then sends HttpWebRequests in regular interval. The server itself will just sit there, sleeping for an amount of time that's close to the requested timeout but always a bit shorter.
Expected behavior: For every request sent, I'll get a response as the timeout set for HttpWebRequests in the Android client is smaller than the time the server takes before sending the response. Actual behavior: If the phone's screen is on, things work as expected. Turn off the screen and you'll get this effect: If the timeout is short enough (server delivers a response in 60 seconds or less), things continue working as usual. Increase the timeout, and you start getting timeouts - according the wireshark, the connection is still there, but when the server sends a response, the client never gets it. In addition, the behavior seems to be phone specific - my Nexus 4 is a major offender - a 120 second wait on the server and a significant amount of requests will time out if the screen is off (if the screen is on, no such problems). My Galaxy S3 and Galaxy Nexus seem much more forgiving, most requests will get a proper response, but occasionally I still get a timeout, seemingly at random. At the same time, those devices can handle much longer delays on the server - the server can sleep for 10 minutes and the response will still be delivered as expected. Note that all those tests have been done over Wifi and wsklo2059.dragonslair.net won't work for you - I'm using dragonslair.net DNS for my personal network, so you must run your own server (link to sample server can be found at the beginning..) I'm wondering - is there any setting that I should use to ensure that the phones will keep the Wifi active while I have an ongoing HttpWebRequest? Is the Nexus4 known to cut off network connection if the screen goes off - is there an Android configuration setting I'm unaware that would trigger such behavior? I do seem to be getting push mails just fine even if the screen is off so that seems to indicate that it's not a generic problem of the device). Regards Stephan -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/HttpWebRequest-freezing-when-turning-off-screen-tp5713192.html Sent from the Mono for Android mailing list archive at Nabble.com. _______________________________________________ Monodroid mailing list [email protected] UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
