BUG: InternetSetOption Does Not Set Timeout Values

ID: Q176420


The information in this article applies to:


SYMPTOMS

Calling InternetSetOption (or MFC CInternetSession::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.


STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.


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.

NOTE: INTERNET_OPTION_RECEIVE_TIMEOUT no longer works in Internet Explorer 5.0. For more information, see the following article in the Microsoft Knowledge Base:

Q224318 HOWTO: Control Connection Timeout Value by Creating Second Thread

© Microsoft Corporation 1999, All Rights Reserved.
Contributions by Leon Braginski, Microsoft Corporation

Additional query words:


Keywords          : kbIE500bug AXSDKMisc 
Version           : WINDOWS:1.0,4.0,4.01,5.0
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: July 7, 1999