Link to home
Start Free TrialLog in
Avatar of ivatury
ivatury

asked on

CInternetSession Problem

Hi ., Im writing a desktop internet search tool ., which sercches different search engines and downloads the results into a htmlpage.

I use CInternetSession->OpenURL()
to get the page.I have my own CInternetSession derived class for status callback so i create this in a thread and i download it from the thread.

Problem is I have GO and STOP buttons on my Searchbar,It works fine when  I say stop while its downloading ,only once ., If i do a go and stop for few times ., CInternetSession just doesnt work at all ., It just hangs.

If I wait for say 15-20 minutes and then say GO it WORKS., May be the active connection object had died by then .,

Any solution how to implement GO and STOP in a more better and non buggy way .,

Bhushan

Avatar of jhance
jhance

It might help if you said a bit about what you are doing in your code when the GO and STOP buttons are clicked.

My guess is that you are leaving something open and running out of resources, connections, or whatever limits CInternetSession.  After some time they time out and you can create more.
You can use SuspendThread()/ResumeThread() to implement STOP/GO. Since you running your code on separate thread it should be easy and reliable.
Avatar of ivatury

ASKER

Im actually exiting the thread i.e instead of resuming and suspending im destroying the thread and creating a new thread ., i was checking with suspend and resume it didnt work .,


Any thing more u need i can post it back

Bhushan
ASKER CERTIFIED SOLUTION
Avatar of jhance
jhance

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ivatury

ASKER

Im actually closing the session object and deleting the session object before i exit the thread., I have a function called DoCleanUp() in the Thread class which closes the session and then cleans up (deletes all objects the way they were constructed).If you need some more information then i would place peices of code on here

Bhushan
Avatar of ivatury

ASKER

Im actually closing the session object and deleting the session object before i exit the thread., I have a function called DoCleanUp() in the Thread class which closes the session and then cleans up (deletes all objects the way they were constructed).If you need some more information then i would place peices of code on here

Bhushan
SHOW THE CODE!

Think about what you're saying here:

"My app doesn't work right but I'm doing everything right.  what can I do to fix it?"