SocketTools .NET Edition

FileTransfer.GetData Method (String, Byte[], Int32)

Transfers the contents of a file on the server and stores it in byte array.

[Visual Basic]
Overloads Public Function GetData( _
   ByVal remoteFile As String, _
   ByVal buffer As Byte(), _
   ByRef length As Integer _
) As Boolean
[C#]
public bool GetData(
   string remoteFile,
   byte[] buffer,
   ref int length
);

Parameters

remoteFile
A string that specifies the file on the remote system that will be transferred to the local system. The file pathing and name conventions must be that of the remote host.
buffer
A byte array that the data will be stored in.
length
An integer value passed by reference which specifies the maximum number of bytes of data to read. This value cannot be larger than the size of the buffer specified by the caller. When the method returns, this value will be updated with the number of bytes actually stored in the byte array.

Return Value

This method returns a boolean value. If the method succeeds, the return value is true. If the method fails, the return value is false. To get extended error information, check the value of the LastError property.

Remarks

The GetData method transfers data from a file on the server to the local system, storing it in the specified buffer . This method will cause the calling 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.

See Also