Downloader.SessionStartToMemory method |
|
Remarks
Starts a download session of a remote file pointed by a URL and stores the downloaded file inside a given memory buffer.
The size of the memory buffer needed to store the full remote file can be obtained through the Downloader.SessionDataSizeGet method.
A successful call to this method will fire the following sequence of events:
- the DownloaderSessionStarted event
- a sequence of DownloaderSessionProgress events informing about the download advancement in percentage
- the DownloaderSessionCompleted event
In case the connection to the remote server or the access to the remote file should fail, the DownloaderSessionFailed would be invoked.
In case the connection should be stopped by the user through a call to the Downloader.SessionStop method, the DownloaderSessionStopped event would be generated.
For details about management of download sessions from HTTP and FTP servers, refer to the How to manage download sessions tutorial.
Syntax
[Visual Basic] control.Downloader.SessionStartToMemory ( strURL as String, strUsername as String, strPassword as String, pBuffer as Variant, nBufferLen as Long, bDisableCache as enumBoolean ) as Long |
[C++] long control.Downloader.SessionStartToMemory ( LPCTSTR strURL, LPCTSTR strUsername, LPCTSTR strPassword, const VARIANT FAR& pBuffer, long nBufferLen, short bDisableCache ); |
Parameter |
Description |
|||||||||
|
|
|||||||||
strURL |
String containing the URL pointing to the remote media file to download. Accepted Internet protocols for the passed URL must be of type HTTPS, HTTP or FTP. |
|||||||||
strUsername |
String containing the username for accessing the server. Leave the string empty if the directory containing the remote file is not username protected. |
|||||||||
strPassword |
String containing the password for accessing the server. Leave the string empty if the directory containing the remote file is not password protected. |
|||||||||
pBuffer |
Variant parameter containing the pointer to the memory buffer where contents of the downloaded file will be stored. The buffer must be previously allocated by the caller using the size obtained through a previous call to the Downloader.SessionDataSizeGet method. When the buffer is no more needed, its deallocation is responsibility of the caller. |
|||||||||
nBufferLen |
Length in bytes of the given buffer. |
|||||||||
bDisableCache |
Flag for determining if the usage of the Internet cache must be disabled or not. Supported values are the following:
|
Return value
Value |
Meaning |
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
Value >= 0 |
The method call was successful and the returned value is the unique identifier of the download session. |
||||||||||||||||||||||||||||||
Negative value |
An error occurred: see the LastError property for error details or for a list of the possible error values. In case the error code should be ERR_DOWNLOADER_REMOTE_FILE_FAILURE or ERR_DOWNLOADER_LOCAL_FILE_FAILURE the Downloader.LastFileExceptionGet method would provide the nature of the error which may assume one of the following values:
|