Problem 1:
Sometimes it hangs for several minutes in pFile->SendRequest()
or pFile->Read() then returns with 12002 operation timed out.
It seems the timeout setting I made for CInternetsession
has no effect.
When accessing the same URL from IE it also hangs, but I can resume
by clicking the STOP button.
I have tried throwing a CInternetException from a CTRL-C handler but
that didn't work.
Question:
How can I abort those functions (asynchronuously from another thread or event
handler) ??
Problem 2: (minor problematic)
Whenever the app is in memory (running or being debugged) any email
reader won't start up. A reader running BEFORE starting my app
continues to work properly. Any ideas ?
I really appreciate any hints (especially on the first problem) !
kind regards
MaJo
--------- code excerpt
DWORD dwAccessType = PRE_CONFIG_INTERNET_ACCESS;
DWORD dwHttpRequestFlags= INTERNET_FLAG_EXISTING_CONNECT;
CInternetSession session( _T("test") );
CHttpConnection* pServer = NULL;
CHttpFile* pFile = NULL;
session.SetOption( INTERNET_OPTION_CONNECT_TIMEOUT, i=5000 );
session.SetOption( INTERNET_OPTION_CONNECT_RETRIES, i=2 );
pServer = session.GetHttpConnection( strServerName, nPort );
pFile = pServer->OpenRequest( CHttpConnection::HTTP_VERB_GET,
"perftest/t10k.txt",NULL,1,NULL,NULL,dwHttpRequestFlags );
pFile->AddRequestHeaders( szHeaders );
pFile->SendRequest();
pFile->QueryInfoStatusCode(dwRet);
if( dwRet == HTTP_STATUS_OK )
{
while( pFile->Read( buf, len) != 0 )
....
}
*******************************************************
* Matthias Joseph, Germany, Eifelweg 40, 34134 Kassel *
* fon: +49 561 93244 55 fax: +49 561 93244 60 *
* email: ma...@t-online.de *
*******************************************************
As to the hang time, you could try to run the session as ASYNC and then
track the progress of the connect yourself... according to the doc, you use
the INTERNET_FLAG_ASYNC flag when creating the session object... you'll also
have to call session.EnableStatusCallBack(TRUE) and override the
session.OnStatusCallBack() function. Then create a timer to track how long
you want to wait and if you exceed your wait time, kill the process and move
on...
This is very "sketchy" but hope it helps
ward
"Matthias Joseph" <ma...@t-online.de> wrote in message
news:n43lftotgfamsdu3n...@4ax.com...
On Thu, 10 May 2001 09:39:23 -0400, you wrote:
>Mathias
> Not sure why the SetOption for Timeout isn't working (Check the return
>value to ensure it is being set) also the code you show:
It was TRUE, so I'd think it was accepted.
>> session.SetOption( INTERNET_OPTION_CONNECT_TIMEOUT, i=5000 );
>will try to set the timeout to 1 since it will evaluate the assignment
>"i=5000" as TRUE (or 1)
>
No, I traced it and it actually calls with timeout=5000
I also checked the default timeout setting it is 30000 (30 sec !)
The default retries setting is 5.
Then I found another one: INTERNET_OPTION_CONNECT_TIMEOUT which also defaults
to 30000. This multiplied by 5 (theretries) makes 2min30sec !
This is about the time I was seeing. So I changed it also to 5000 and now it's
somewhat better.
>As to the hang time, you could try to run the session as ASYNC and then
>track the progress of the connect yourself... according to the doc, you use
>the INTERNET_FLAG_ASYNC flag when creating the session object... you'll also
>have to call session.EnableStatusCallBack(TRUE) and override the
>session.OnStatusCallBack() function. Then create a timer to track how long
>you want to wait and if you exceed your wait time, kill the process and move
>on...
>
>This is very "sketchy" but hope it helps
>ward
*******************************************************