Copyright © 2001-2018 MultiMedia Soft

Downloader.SessionDataSizeGet method

Previous pageReturn to chapter overviewNext page

Remarks

 

Obtains the size in bytes of the remote file pointed by the given URL.

This method can be used to determine the size of the memory buffer needed to perform a memory-based downloading of a remote file through the Downloader.SessionStartToMemory method.

 

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.SessionDataSizeGet (

strURL as String,

strUsername as String,

strPassword as String,

nDataSize as Long,

nSdkError as Long,

pBufferExtendedError as Variant,

nBufferLen as Long

) as enumErrorCodes


 

[C++]

short control.Downloader.SessionDataSizeGet (

LPCTSTR strURL,

LPCTSTR strUsername,

LPCTSTR strPassword,

long *nDataSize,

long *nSdkError,

const VARIANT FAR& pBufferExtendedError,

long *nBufferLen

);


 

 

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 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.

nDataSize

Reference that, on return from the method call, will contain the size in bytes of the remote file.

nSdkError

Reference that, on return from the method call, and in case of error will contain the eventual error code defined by the Windows SDK.

In case the error code should be ERROR_INTERNET_EXTENDED_ERROR (12003), this would mean that an extended error was returned from the server. This is typically a string or buffer containing a verbose error message; the string containing the message is provided back to the caller through the memory buffer pointed by the pBufferExtendedError parameter.

pBufferExtendedError

Variant parameter containing the pointer to the memory buffer where an eventual extended error message will be stored: when returning from the method call, the buffer will contain a string in Unicode characters.

This buffer must be previously allocated by the caller and when the buffer is no more needed, its deallocation is responsibility of the caller.

nBufferLen

Reference containing the length in bytes of the given buffer: it's recommended setting a buffer with a minimal size of 1024 bytes.

When returning from the call to this method, in case of error and if the nSdkError parameter should contain ERROR_INTERNET_EXTENDED_ERROR (12003), this parameter will contain the exact size in characters of the extended error string stored inside the buffer pointed by the pBufferExtendedError parameter.

 

 

Return value

 

Value

Meaning

 

 

enumErrorCodes.NOERROR (0)

The method call was successful.

Negative value

An error occurred: see the LastError property for further error details or for a list of the possible error values.

In case of error the nSdkError and pBufferExtendedError parameters may contain further information about the nature of the error.