BUG: InternetSetOption does not set timeout values (176420)



The information in this article applies to:

  • Microsoft ActiveX SDK
  • Microsoft Internet Client SDK 4.0
  • Microsoft Internet Client SDK 4.01
  • Microsoft Internet Explorer (Programming) 5
  • Microsoft Internet Explorer (Programming) 6 (SP1)
  • Microsoft Pocket PC 2002
  • Pocket PC Phone Edition 1.0

This article was previously published under Q176420

SYMPTOMS

Calling InternetSetOption (or MFC CHttpFile::SetOption) with INTERNET_OPTION_SEND_TIMEOUT or INTERNET_OPTION_CONNECT_TIMEOUT does not set the specified timeout values.

RESOLUTION

To work around the problem you can use asynchronous WinInet mode, which prevents the WinInet function call from blocking while waiting for a connection. Please see the Internet Client SDK documentation for more information about using WinInet asynchronously. Another solution may be to create a second thread that would call blocking WinInet API. Closing the handle from within the original thread will cancel blocking API in the second thread. Please see documentation for InternetCloseHandle for more details.

INTERNET_OPTION_RECEIVE_TIMEOUT no longer works in Microsoft Internet Explorer 5.0.

For more information, click the following article number to view the article in the Microsoft Knowledge Base:

224318 How to control connection timeout value by creating second thread

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.

The latest version of the Wininet.dll file that is included with MIcrosoft Internet Explorer 5.01 fixes all time-out problems for HTTP APIs only. FTP time-outs still cannot be changed. Internet Explorer 5.01 is available for download.

MORE INFORMATION

InternetSetOption works for INTERNET_OPTION_RECEIVE_TIMEOUT. The receive timeout option controls how long to wait for incoming data to become available. It does not control how long to wait while connecting to or sending data to the server. If the network is down or the server is not available, a WinInet function call that makes a connection (HttpSendRequest, for example) can potentially block for a long time.

Modification Type:MinorLast Reviewed:7/11/2006
Keywords:kbBug KB176420