InternetSetOption with INTERNET_OPTION_CONNECT_TIMEOUT does not have any effect
Hello,
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.
From MSDN:
Quote:
INTERNET_OPTION_CONNECT_TIMEOUT
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.
I am using the following code:
Code:
bool ret = InternetSetOption ( m_InternetConnect, INTERNET_OPTION_CONNECT_TIMEOUT, &timeout, sizeof(timeout) );
assert ( ret );
It never fails in assert also?
Am I doing anything wrong...
Regards,
Karam
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.
Regards,
Karam