dlyle
2008-04-11 15:48:01 UTC
Sorry for the caveman speak title -- I couldn't fit all the key words
I wanted to "tag" this subject with and also have a full sentence!
Basically I am trying to implement the suggestion of the kb article:
"How To Control Connection Timeout Value by Creating Second Thread" at
the website: "http://support.microsoft.com/kb/224318/EN-US/". The only
difference with my code is that I'm trying to control the connection timeout
for HttpSendRequest. With a timeout value of 5000 ms, the
WaitForSingleObject call times out in 5 seconds as expected but when I
subsequently call InternetCloseHandle on the HttpRequest handle and the Http
connection handles on the parent thread, the child thread's blocked call to
HttpSendRequest doesn't seem to unblock for at least 10-20 seconds after
InternetCloseHandle was called on the main (parent) thread. Is there a way
around this latency?
I'm testing the send timeout using the Fiddler2 internet tool that allows
you to set breakpoints for specific url requests. Thus I set a breakpoint in
Fiddler2 for the url the code is sending an HttpSendRequest to via WinInet,
and I don't hit the button to continue from the breakpoint (i.e. forward the
request from Fiddler2). This causes the timeout in the main thread that has
launched a separate thread for HttpSendRequest and is waiting on that thread
with the given timeout value. When InternetCloseHandle is then called upon
timeout expiration the child thread isn't unblocking its call to
HttpSendRequest.
Has anyone experienced similar issues. I'd rather not have to rewrite the
code to use the asynchronous WinInet calls, but perhaps that is the best
solution. If that is, does anyone have links to good examples of programming
WinInet (ideally with good error handling) using the asynchronous calls?
Thanks! :)
I wanted to "tag" this subject with and also have a full sentence!
Basically I am trying to implement the suggestion of the kb article:
"How To Control Connection Timeout Value by Creating Second Thread" at
the website: "http://support.microsoft.com/kb/224318/EN-US/". The only
difference with my code is that I'm trying to control the connection timeout
for HttpSendRequest. With a timeout value of 5000 ms, the
WaitForSingleObject call times out in 5 seconds as expected but when I
subsequently call InternetCloseHandle on the HttpRequest handle and the Http
connection handles on the parent thread, the child thread's blocked call to
HttpSendRequest doesn't seem to unblock for at least 10-20 seconds after
InternetCloseHandle was called on the main (parent) thread. Is there a way
around this latency?
I'm testing the send timeout using the Fiddler2 internet tool that allows
you to set breakpoints for specific url requests. Thus I set a breakpoint in
Fiddler2 for the url the code is sending an HttpSendRequest to via WinInet,
and I don't hit the button to continue from the breakpoint (i.e. forward the
request from Fiddler2). This causes the timeout in the main thread that has
launched a separate thread for HttpSendRequest and is waiting on that thread
with the given timeout value. When InternetCloseHandle is then called upon
timeout expiration the child thread isn't unblocking its call to
HttpSendRequest.
Has anyone experienced similar issues. I'd rather not have to rewrite the
code to use the asynchronous WinInet calls, but perhaps that is the best
solution. If that is, does anyone have links to good examples of programming
WinInet (ideally with good error handling) using the asynchronous calls?
Thanks! :)