[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

CInternetSession Problem

Posted on 2000-04-07
7
Medium Priority
?
413 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

650 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