Copyright © 2011-2023 MultiMedia Soft

How to manage download sessions

Previous pageReturn to chapter overviewNext page

Downloading tasks can be achieved through the DownloaderEd class object accessible through the Downloader property.

 

The DownloaderEd class, which is intended for download of remote files only (so downloading from broadcasting streaming servers or radio stations is not supported), can be instanced and started through the Downloader.Create method and exposes the following features:

 

downloading a remote file and storing its contents inside a local file through the Downloader.SessionStartToFile method.

 

downloading a remote file and storing its contents inside a local memory buffer through the Downloader.SessionStartToMemory method: the size of the buffer, whose allocation is responsibility of the container application, can be determined through the Downloader.SessionDataSizeGet method.

 

 

All of the mentioned methods allow starting the downloading session and, in case of success, a session's unique identifier is returned: through this identifier you have the possibility to interrupt the same downloading session through the Downloader.SessionStop method.

 

During the download session, the container application is notified about the advancement through the CallbackForDownloaderEvents delegate which is invoked with the nEvent parameter set to one of the following values:

 

- the EV_DOWNLOADER_SESSION_STARTED event reports that the downloading session is started

- the EV_DOWNLOADER_SESSION_PROGRESS event informs about the download advancement expressed in percentage

- the EV_DOWNLOADER_SESSION_COMPLETED event reports that the downloading session is completed successfully

- the EV_DOWNLOADER_SESSION_FAILED event reports that the connection to the remote server or the access to the remote file failed

- the EV_DOWNLOADER_SESSION_STOPPED event reports that the downloading session has been stopped by the user manually through a call to the Downloader.SessionStop method.

 

When invoking the Downloader.Create method you can specify timeouts checked during the connection to the remote server and during data downloading: these timeouts can be modified at any time through the Downloader.SetTimeouts method.

 

 

A sample of usage the downloader in Visual Basic 6 can be found inside the following sample installed with the product's setup package:

- Downloader