473,320 Members | 1,600 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Asynchronous WebRequest Timeout bug

http://msdn2.microsoft.com/en-us/library/21k58ta7.aspx

I'm using that example as my starting point. The timeout it has though is
not bulletproof. It will timeout if it doesn't connect within the timeout
period, but if it connects and the server sends 1 byte and then hangs the
connection open, it will not timeout. I'd like to include another timeout
(let's say 10 seconds) for the read not finishing (or alternatively a timeout
that encompasses the entire process or opening a connection and getting the
response).

Im RespCallback I tried to add another WaitForSingleObject call, but it
didn't seem to help.

// Begin the Reading of the contents of the HTML page and
print it to the console.
IAsyncResult asynchronousInputRead =
responseStream.BeginRead(myRequestState.BufferRead , 0, BUFFER_SIZE, new
AsyncCallback(ReadCallBack), myRequestState);

//ADDED - Added a timeout to confirm that data finishes
reading

ThreadPool.RegisterWaitForSingleObject(asynchronou sInputRead.AsyncWaitHandle,
new WaitOrTimerCallback(TimeoutCallback), myHttpWebRequest,
DefaultReadTimeout, true);

Any ideas?
Mar 29 '06 #1
0 1101

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Gordon | last post by:
I use the following code to get source HTML. The second line seems to work when I get no response from a site. However, I want to stop the request if it's taking more than 20 - 30 seconds. I can't...
5
by: archana | last post by:
Hi all i am having application which is using asychronous web request. At a time i am processing 5 urls asynchronously. Application working properly for 5 asynchronous call. But sometimes CPU...
1
by: Assaf Shemesh | last post by:
Hi, I'm having a problem with asynchronous HttpWebRequest. It's a simple http client-server. For most of my users it works fine. However, some of them get the exception: ...
3
by: Maya Sam | last post by:
Hi all, I have the following code I created to do multiple websites data crawling using Asynchronous Thread calling it works fine however I'm confused when it comes to make the calling thread...
3
by: Jonathan | last post by:
I appreciate anyone's insight on this as I am new to web programming with .NET. I have a simple method which I use to send various HTTP requests to a web server (snippet below). On the first...
0
by: davidpenty | last post by:
Hi there, I am having some problems with a multi-threaded asp.net seach page. My search page sends off four asynchronous http requests to four search engines then waits for the results to come...
2
by: archana | last post by:
Hi all, I am processing asynchronous web request with setting timeout using RegisterWaitForSingleObject. On beginwebrequest i am sending address of one callback which i want to execute when...
0
by: archana | last post by:
Hi all, I am having application wherein i am processing some asynchronous webrequest. I have declared one timeout callback as specified in MSDN for implementing timeout for aysnchornous web...
0
by: APA | last post by:
I've seen the MS sample async web request pattern and I ask is it really async if it is using a ManualResetEvent and setting WaitOne()? The ManualResetEvent object is being declared as a static...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.