Hello,
I'm trying to use the CountingStream to retrieve and display the remote file size and download progress.
Apparently monitoring could be done from a Poco task but I can't get any counting info in the outputstream or inputstream.
Downloading a file is no problem but finding a way to show the actual download progress is not obvious.
I've see a few post here and there about the issue (with upload) but nothing really straightforward to use with download.
I'm doing something like this
try
{
Poco::URI uri(myremotefile);
std::auto_ptr<std::istream> pStr(Poco::URIStreamOpener::defaultOpener().open(uri));
// I have no idea how to retrieve the file size from this istream, CountingInputStream won't work here
// Any help would be nice for getting this info
Poco::Path p(true);
Poco::FileOutputStream fo(p.temp()+mylocalfilename);
// as streamcopier waits until the full copy is done, I'm trying to count the actual download progress from a Poco Thread
Poco::CountingOutputStream ostr(fo);
MySizeCounter sc(ostr);
Poco::Thread t;
t.start(sc);
Poco::StreamCopier::copyStream(*pStr.get(), fo);
fo.Close();
sc.done(); // stop the counting thread
t.join();
}
catch(Poco::Exception& exc)
{
std::cerr << exc.displayText() << std::endl;
}
This code downloads the file but does not count any progress (countingstream stays at 0).
Any help or even better a sample code would be great if anybody can help.
Thanks in advance.





