Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ MT-multithreading and servers » Stop Download
Stop Download [message #20910] Fri, 17 April 2009 14:43 Go to next message
MohamedMonem is currently offline  MohamedMonem
Messages: 7
Registered: March 2009
Promising Member
Hi All

how can I stop running download, I use this function

ExecuteRedirect(....,....,...);

I want to make button or some thing when pushed the download will be canceled !

Thanx in advance
Re: Stop Download [message #20912 is a reply to message #20910] Fri, 17 April 2009 15:21 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 11844
Registered: November 2005
Ultimate Member
Via progress Gate.

Mirek
Re: Stop Download [message #27406 is a reply to message #20912] Thu, 15 July 2010 17:52 Go to previous messageGo to next message
mubeta is currently offline  mubeta
Messages: 61
Registered: October 2006
Member
Hi all,
well, I have the same problem. Using an hidden thread my application download from remote server, via http, files or program updates.

The user don't see any progress bar, because this thread is hidden, so:

1) How I can stop the download when application is closed?
2) Otherwise, how I can show an progress bar in a different thread? (I am thinking for a small progress bar, in the application status bar).

3) Using HttpClient, how I can know if the PC is connected to Internet, for don't wait a lot of time for timeout?

thanks.
mubeta.
Re: Stop Download [message #27439 is a reply to message #27406] Sat, 17 July 2010 23:03 Go to previous message
mubeta is currently offline  mubeta
Messages: 61
Registered: October 2006
Member
Ok, I found an fast solution:

1) Using an hidden progress that take in account the "tarminate" flag:
class MyHideProgress {
protected:
	int                 	total, pos;
	volatile Atomic     	*terminated;

public:
	bool     SetCanceled(int p, int t)     { pos = p; total = t; return (bool)*terminated; }

	operator Gate2<int, int>()             { return callback(this, &MyHideProgress::SetCanceled); }

  typedef MyProgress CLASSNAME;

	MyHideProgress(volatile Atomic *t)		 { terminated = t; }
};


2) In this way the gui program can be closed quickly also with HttpClient working in background thread.
Previous Topic: Socket and multiple Threads
Next Topic: PROPOSAL: Monitor mutex in objects
Goto Forum:
  


Current Time: Thu Apr 25 11:47:39 CEST 2019

Total time taken to generate the page: 0.00985 seconds