简体   繁体   中英

winCE C# HttpWebresponse timeout

I'm programming a Windows CE 6 device and want to make a request on a local Server! The device and the Server are in the same Wireless Network.

The device tries to perform a getresquest() on the Server.

public int test()
{
    string var1 = "whatever";
    req = (HttpWebRequest)WebRequest.create("http://192.168.x.x/test.php?var1=" + var1);

The requesttimeout is set to 1 second.

req.Timeout = 1000;

Then I Try to get a response:

try
{
    res = (HttpWebResponse)req.GetResponse();
}

catch(Exception e)
{
    //What happens if an exception occures
}

My big problem is that the request sometimes times out but send the data to the server! Is there a possiblity to check if the data was transfer to the server or not?

The timeout applies to the time required to send the request and get a response back from server. In that case it seems that send has been completed and timeout happens when your client is waiting for the response.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM