HttpWebRequest Timeout in WP7?

In case you missed it allDone is supposed to be a ManualResetEvent and you can pass either an integer number of milliseconds or a TimeSpan as the amount of time to wait before continuing. For example: private ManualResetEvent _waitHandle = new ManualResetEvent(false); private bool _timedOut; ... this. _timedOut = false; this.

_waitHandle.Reset(); HttpWebRequest request = HttpWebRequest. CreateHttp("http://cloudstore.blogspot.com"); request. BeginGetResponse(this.

GetResponse_Complete, request); bool signalled = this. _waitHandle. WaitOne(5); if (false == signalled) { // Handle the timed out scenario.This.

_timedOut = true; } private void GetResponse_Complete(IAsyncResult result) { // Process the response if we didn't time out. If (false == this. _timedOut) { HttpWebRequest request = (HttpWebRequest)result.

AsyncState; WebResponse response = request. EndGetResponse(result); // Handle response. } } Alternatively, you could use a third party library such as Hammock which enable syou to do timeouts and retry attempts (among other things).

Depending on your project, that might be more than you need, though :).

In case you missed it, allDone is supposed to be a ManualResetEvent, and you can pass either an integer number of milliseconds or a TimeSpan as the amount of time to wait before continuing. For example: private ManualResetEvent _waitHandle = new ManualResetEvent(false); private bool _timedOut; ... this. _timedOut = false; this.

_waitHandle.Reset(); HttpWebRequest request = HttpWebRequest. CreateHttp("http://cloudstore.blogspot.com"); request. BeginGetResponse(this.

GetResponse_Complete, request); bool signalled = this. _waitHandle. WaitOne(5); if (false == signalled) { // Handle the timed out scenario.This.

_timedOut = true; } private void GetResponse_Complete(IAsyncResult result) { // Process the response if we didn't time out. If (false == this. _timedOut) { HttpWebRequest request = (HttpWebRequest)result.

AsyncState; WebResponse response = request. EndGetResponse(result); // Handle response. } } Alternatively, you could use a third party library such as Hammock, which enable syou to do timeouts and retry attempts (among other things).

Depending on your project, that might be more than you need, though :).

This worked great, thanks! – willmel Jan 20 at 18:13.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions