Solved

CInternetSession Problem

Posted on 2000-04-07
7
392 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

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…
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…
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.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

808 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