简体   繁体   English

winCE C#HttpWebresponse超时

[英]winCE C# HttpWebresponse timeout

I'm programming a Windows CE 6 device and want to make a request on a local Server! 我正在对Windows CE 6设备进行编程,想在本地服务器上发出请求! The device and the Server are in the same Wireless Network. 设备和服务器在同一无线网络中。

The device tries to perform a getresquest() on the Server. 设备尝试在服务器上执行getresquest()

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. requesttimeout设置为1秒。

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. 在这种情况下,当客户端等待响应时,发送似乎已经完成,并且发生了超时。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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