Does anybody have any experience using the CInternetSession::SetOption() to
set the timeout for CHttpFile::Read()? Or is there any other method to do
the job?
I have tried the CInternetSession::SetOption() as follow (it did not work):
CInternetSession session("Http");
session.SetOption( INTERNET_OPTION_DATA_RECEIVE_TIMEOUT, 10000);
CHttpConnection pServer = session.GetHttpConnection( ServerName, nPort);
CHttpFile File = pServer.OpenRequest(CHttpConnection::HTTP_VERB_POST, file);
try
{
File.SendRequest(sHeader,(LPVOID)sBody, sBody.GetLength());
}
catch(CInternetException *e )
{
..............
e->Delete();
return FALSE;
}
UINT nRead;
DWORD dwRet;
File.QueryInfoStatusCode(dwRet);
if(dwRet == HTTP_STATUS_OK)
{
try
{
while(nRead=pFile.Read(szBuf, 100)){
............
}
}
catch(CInternetException *e)
{
............
e->Delete();
}
The problem is this:
If the Web Server returned some data, then crashed or just sat idle forever
without returning anything . It should time out after 10 seconds as I have
set in the CInternetSession::SetOption(), but it failed to do that. It
also sat idle until it finally received an Internet Exception at
approximately 15 minutes later.
"Alex Nechiporenko" <al...@exclusivesoft.com> wrote in message
news:E78928DB-D9B3-45B8...@microsoft.com...
"Alex Nechiporenko" <anon...@discussions.microsoft.com> wrote in message
news:19EEF1FA-E782-4B18...@microsoft.com...
> But they say that this bug was fixed from IE 5.01. And I have IE 6.0
installed.
"Alex Nechiporenko" <anon...@discussions.microsoft.com> wrote in message
news:05DD13FB-B92F-4D85...@microsoft.com...
> From
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q176/4/20.asp&NoWebContent=1 :
>
> "The latest version of the Wininet.dll file that shipped with Internet
Explorer 5.01 (available for download) fixes all timeout problems for HTTP
APIs only. FTP timeouts still cannot be changed."