?
Solved

CInternetSession Problem

Posted on 2000-04-07
7
Medium Priority
?
406 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

 
LVL 32

Accepted Solution

by:
jhance earned 600 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

764 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