August 24th, 2004, 01:05 AM
InternetSetOption with INTERNET_OPTION_CONNECT_TIMEOUT does not have any effect
I am setting the timeout value for my HTTP handle using the above method. The problem is whatever value I put e.g. 1ms, the connection is never timedout even if the process of executing and getting the result takes more then 1ms.
I am using the following code:
Sets or retrieves an unsigned long integer value that contains the time-out value to use for Internet connection requests. Units are in milliseconds. If a connection request takes longer than this time-out value, the request is canceled. When attempting to connect to multiple IP addresses for a single host (a multihome host), the timeout limit is cumulative for all of the IP addresses. This option can be used on any HINTERNET handle, including a NULL handle. It is used by InternetQueryOption and InternetSetOption.
It never fails in assert also?
bool ret = InternetSetOption ( m_InternetConnect, INTERNET_OPTION_CONNECT_TIMEOUT, &timeout, sizeof(timeout) );
assert ( ret );
Am I doing anything wrong...
August 24th, 2004, 08:47 AM
See Q176420, which describes, why timeouts cannot be set with InternetSetOption (Bug with Microsoft)
The Saviour of the World is a Penguin and Linus Torvalds is his Prophet.
August 24th, 2004, 01:23 PM
Re: InternetSetOption with INTERNET_OPTION_CONNECT_TIMEOUT does not have any effect
Thanks a lot buddy
This brings to my next problem which is very similar. Now if I using the method:
ret = InternetSetOption ( m_InternetConnect, INTERNET_OPTION_RECEIVE_TIMEOUT, &timeout, sizeof(timeout) );
and say timeout = 10.
Whenever, I use the following method:
InternetWriteFile( m_HttpOpenRequest, data, datalen, &byteswritten );
I get the error:
Error Code : 12019
The handle is in the wrong state for the requested operation
Shouldnt it return some error like : Reuqest timed out.
On second thought I did a google and came across this Knowledge base - http://support.microsoft.com/default...b;EN-US;177190
As suggested I am now using INTERNET_FLAG_NO_CACHE_WRITE, but still the problem remains.
BTW, if I increase the timeout value - everything works. So I was just wondering, is the error message correct?
Thanks in advance.
Click Here to Expand Forum to Full Width