|
-
May 12th, 1999, 11:41 AM
#1
How to set timeout value for CHttpFile::SendReqeust()?
How do I set a timeout value for the CHttpFile::SendRequest() method? It seems like SendRequest will keep trying to send requests to a server for up to 5 minutes. I want to be able to reduce it to about 30 seconds... Anyway to do this? Thanks.
-
May 18th, 1999, 12:18 PM
#2
Re: How to set timeout value for CHttpFile::SendReqeust()?
Have you figured out how to set the time out to something other than 5 minutes? My problem is very similar, but I need to increase the amount of time before the timeout. If you find the answer to your question, would you please post it here?
thanx,
John
-
January 13th, 2003, 11:18 AM
#3
Now, I am facing this problem. Have you resolved it? Please tell me how to increase the timeout. Thanks very much!
CheQuan
-
January 13th, 2003, 02:39 PM
#4
In MFC, use the CInternetSession::SetOption and set the timeout value for the INTERNET_OPTION_CONNECT_TIMEOUT flag.
With Wininet, you can directly call InternetSetOption api.
This timeout will apply to all the 'SendRequest' calls for that session. I dont know if you can set the timeout for every individual SendRequest (i also dont know why you'd want to do that).
-
July 20th, 2009, 03:35 PM
#5
Re: How to set timeout value for CHttpFile::SendReqeust()?
Hello
This answer is not correct.
The question was how to set the timeout for SendRequest(), but INTERNET_OPTION_CONNECT_TIMEOUT sets the timeout to CONNECT the server.
So you should set INTERNET_OPTION_RECEIVE_TIMEOUT.
I tried it. It works:
CInternetSession i_Session;
i_Session.SetOption(INTERNET_OPTION_RECEIVE_TIMEOUT, 1000);
sets timeout of 1 second (just for testing) and throws exception if exceeded.
But it makes much sense to set BOTH timeouts because if you have a network problem your application will hang 5 MINUTES when it cannot connect the server.
(What a stupid default timeout!)
Last edited by Elmue; July 20th, 2009 at 03:49 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|