Back to product page

GetFile method


Receives file from the server.

Type

Void

Syntax

  • C#
  • VB.NET
public Void GetFile();

public Void GetFile(Stream ToStream);
The GetFile(ToStream) syntax has these parts:
ToStreamLocal stream that where wodFtpDLX.NET will write data to.

public Void GetFile(String RemoteFile);
The GetFile(RemoteFile) syntax has these parts:
RemoteFileFull path to filename on the server.

public Void GetFile(Stream ToStream, String RemotePath);
The GetFile(ToStream,RemotePath) syntax has these parts:
ToStreamLocal stream that where wodFtpDLX.NET will write data to.
RemotePathFull path to filename on the server.

public Void GetFile(String LocalPath, String RemotePath);
The GetFile(LocalPath,RemotePath) syntax has these parts:
LocalPathFull path to filename (or directory) on your local disk.
RemotePathFull path to filename on the server.

public Sub GetFile()

public Sub GetFile(ByVal ToStream As Stream)
The GetFile(ToStream) syntax has these parts:
ToStreamLocal stream that where wodFtpDLX.NET will write data to.

public Sub GetFile(ByVal RemoteFile As String)
The GetFile(RemoteFile) syntax has these parts:
RemoteFileFull path to filename on the server.

public Sub GetFile(ByVal ToStream As Stream, ByVal RemotePath As String)
The GetFile(ToStream,RemotePath) syntax has these parts:
ToStreamLocal stream that where wodFtpDLX.NET will write data to.
RemotePathFull path to filename on the server.

public Sub GetFile(ByVal LocalPath As String, ByVal RemotePath As String)
The GetFile(LocalPath,RemotePath) syntax has these parts:
LocalPathFull path to filename (or directory) on your local disk.
RemotePathFull path to filename on the server.

Remarks

GetFile method will initiate copying of file residing on remote server to the local computer. During the transfer, Progress event will be fired several times, depending on your network speed and length of the file. When the copying is completed, Done event will be fired.

If an error occurs during transfer, Done event will be fired immediately containing Args.Error with the description of the error, and transfer will be aborted. If you want to continue it later, or try to re-receive the file, initiate GetFile method again (immediately or after reconnecting, depends on error that occurred). You may also use Resume property to resume transferring from the position where the error occurred.

This method can be initiated only when State property is set to Connected. You cannot receive file if wodFtpDLX.NET is busy doing something else.

Although RemoteFile argument MUST contain full path including filename of the file you wish to receive, you can omit filename from the LocalPath argument. For instance, you can set

LocalPath = "C:\Temp"

in which case wodFtpDLX.NET will automatically copy it with the same name as it is on remote server. If you wish to specify that is copied with some other name, you have to include it in LocalPath argument.

If you don't specify LocalPath or RemoteFile argument, wodFtpDLX.NET will use values set in LocalPath and RemotePath properties.

No wildcards can be used for RemotePath argument. RFC protocol specifications for FTP and SFTP do not allow them.

Do not forget that RemotePath should always specify full absolute path (i.e. /home/joe/something) instead of relative path (i.e. joe/something). LocalFile should also specify full path (i.e. C:\home\joe\something) instead of relative path (i.e. joe\something).

Platforms

Windows