Solved

CInternetSession Problem

Posted on 2000-04-07
7
381 Views
Last Modified: 2013-11-20
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

0
Comment
Question by:ivatury
  • 3
  • 3
7 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 2692943
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.
0
 
LVL 8

Expert Comment

by:gelbert
ID: 2693646
You can use SuspendThread()/ResumeThread() to implement STOP/GO. Since you running your code on separate thread it should be easy and reliable.
0
 

Author Comment

by:ivatury
ID: 2694454
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
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 32

Accepted Solution

by:
jhance earned 200 total points
ID: 2694510
Yes BUT,

How about some information concerning the disposition of your CInternetSession and any connections it has open when your thread exists.

If you are creating these using new then they will outlive the thread's termination.  I'm not sure of the particulars but I know that there is a limit on how many CInternetSession connection you can open before the library fails to open more.  After a timeout period, the connections will eventually die and you will be able to open more.

I think you need to do some cleanup on the connection and session objects before exiting your threads.

Bottom line is that experts can't be of much help if you are unwilling to provide more information.
0
 

Author Comment

by:ivatury
ID: 2695366
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
0
 

Author Comment

by:ivatury
ID: 2695421
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
0
 
LVL 32

Expert Comment

by:jhance
ID: 2695811
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?"
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now