CInternetSession * session;//如何才能设置超时时间?
//CInternetSession类提供的设置超时的方法好像不起作用。session.OpenURL(myurl);

解决方案 »

  1.   

    BUG: InternetSetOption Does Not Set Timeout Valueshttp://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.