GetData Method

Transfer data from the server and store it in a local buffer.

Syntax

object.GetData( Resource, Buffer, [Length], [Options] )

Remarks

The GetData method transfers data from the server to the local system, storing it in the specified buffer . This method will cause the current thread to block until the file transfer completes, a timeout occurs or the transfer is canceled. During the transfer, the OnProgress event will fire periodically, enabling the application to update any user interface objects such as a progress bar.

Resource
A string that specifies the resource on the server that will be accessed. If the resource specifies a file, then the contents of the file will be returned to the server. If the resource specifies a script or other executable content, it will be executed and the output will be transferred to the local system. The file pathing and name conventions must be that of the remote host.
Buffer
This parameter specifies the local buffer that the data will be stored in. If the variable is a String type, then the data will be returned as a string of characters. This is the most appropriate data type to use if the file on the server is a text file. If the remote file contains binary data, it is recommended that a Byte array variable be specified as the argument to this method.
Length
An optional integer argument that will contain the number of bytes copied into the buffer when the method returns.
Options
An optional integer value which specifies one or more options. This argument is constructed by using a bitwise operator with any of the following values:
Value Constant Description
0 httpTransferDefault The default transfer mode. The resource data is copied to the local system exactly as it is stored on the server.
1 httpTransferConvert If the resource being downloaded from the server is textual, the data is automatically converted so that the end of line character sequence is compatible with the Windows platform. Individual carriage return or linefeed characters are converted to carriage return/linefeed character sequences.

Return Value

A value of zero is returned if the operation was successful, otherwise a non-zero error code is returned which indicates the cause of the failure.

See Also

GetFile Method, PutData Method, PutFile Method, OnProgress Event


Copyright © 2008 Catalyst Development Corporation. All rights reserved.