BIGDNF

I'm building application which will be working on pocket device and connect to network by Wi-Fi. On cable my app is working well but when I'm connecting using wi-fi really weird things are happening.

Firstly I'm using HttpWebRequeste/Response to get some xml (I'm deserializing this file to proper class). And this is the moment when usually time-out or occur (on request.GetResponse) even when I set time out to 10000. I use loop to try couple of times to download this file and this work ... for while. After this operation I'm downloading couple of files (witch another function and completely separated objects - but from the same web location) - and really strange thing occurs. When I'm downloading first file this is not my file but xml file again, and when I¡¯m downloading second file it occurs that this is my first file!!!. I notice that this not happening when time out don't occur. I don't know what to do - I always close all streams and response objects and I try to set KeepAlive on HttpWebRequest to False but this bug always occurs.



Re: .NET Compact Framework Problem with timeout and Wifi

BIGDNF

Maybe I show some sources:

Code Snippet

while (netTimeOutCounter < 10)
{
try
{
helperRequest = (HttpWebRequest)HttpWebRequest.Create(new Uri(source));
helperRequest.KeepAlive = false;
helperRequest.Timeout = HTTPTimeout;

helperResponse = (HttpWebResponse)helperRequest.GetResponse();
helperStreamReader = new BinaryReader(helperResponse.GetResponseStream());
netTimeOutCounter = 20;
}
catch (WebException ee)
{
netTimeOutCounter++;

}

}

Do I miss something





Re: .NET Compact Framework Problem with timeout and Wifi

Andrew Arnott - MSFT

What version of NetCF are you running Many bug fixes went into the HTTP classes in 2.0 and its service packs, so if you're using 1.0 I would first try upgrading to 2.0 and see if that fixes your problem.

Secondly, your code snippet doesn't appear to be closing the Response objects in the case of an error. It's important that even in your catch block that you ee.Response.Close().