Posted on 2010-05-06 17:24
S.l.e!ep.¢% 阅读(1056)
评论(0) 编辑 收藏 引用 所属分类:
VC
BUG: InternetSetOption Does Not Set Timeout Values
http://support.microsoft.com/kb/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.