Re: OpenURL chrashes
OpenUrl throws a CInternetException* exception, not a CInternetException.
Norbert,
you were right: the * was missing, thank you.
However, there is still an issue
with the following code:
CWnd * pWnd = AfxGetMainWnd();
URLstatus status;
int bufgr = 2500000;
BYTE* buffer = new BYTE[bufgr];
int nBytesRead = 0;
CInternetSession Isession;
CHttpFile* pFile = NULL;
try
{
pFile = (CHttpFile*)Isession.OpenURL(URLadr);
}
catch(CInternetException * e)
{
_BrowseInfo.CSmessage = "Wrong URL: " + URLadr;
delete [] buffer;
if(pFile) delete pFile;
Isession.Close();
_BrowseInfo.i_visitedSitesSession ++;
_BrowseInfo.i_unvisitedLinksDB --;
_BrowseInfo.i_Imagesfound = 0;
status.Bsucces = FALSE;
pWnd -> PostMessage(WM_Protocol, 10, 0);
return status;
}
I use it in a programme with up to 60 threads to browse many websites
simultanious.
After serveral minutes with a 1 MBit connenction some of the threads
crash (Runtime error).
The code works perfect in single threaded use.
It runs also stable if the number of treads are restricted to 10.
I find it very hard to trace the reason.
Does anybody know about general limitations of multithreading?
Thanks for any hint and a happy 2008!
Kai Sandner