wodSFTP ActiveX Control - RemoteRead Method
      
 

Description

Reads from remote file.


Return Type

A String value. Data that is read (only in Blocking mode).


Syntax

object.RemoteRead RemotePosLo, RemotePosLo, Count, [Type]


The RemoteRead Method syntax has these parts:

Part Description
object An expression evaluating to an object of type wodSFTP.
RemotePosLo A Long value. Low 32 bit of position in the remote file where read occurs.
RemotePosHi A Long value. High 32 bit of position in the remote file where read occurs (usually 0).
Count A Long value. Total number of bytes to read.
Type Optional. A Variant value. Specifies type of data to return in RemoteData event (String or Byte Array)

Remarks

The RemoteRead method will read data from remote file opened with RemoteOpen method. When data is received, it will be provided to your application through RemoteData event. When receive completes, Done event will be fired, where you can call new RemoteRead, close remote file etc.. During the transfer, Progress event WILL NOT be fired.

If you specify -1 then complete file will be read from one RemoteRead method call.  After you finish reading all the data, don't forget to call RemoteClose. You can not call other methods until RemoteClose is called (for example, you cannot call GetFile).

In Blocking mode, RemoteRead will return data immediately to you (so you can ignore RemoteData event).

The Type parameter should be vbString (8) which means that the returned type will be a string, otherwise it should be vbByte (17) or vbArray(8192) which means that returned data will be a byte array. Depending on your choice, you should store it in an appropriate variable.

You can use RemoteRead like this, to read full remote file:

Dim sftp1 As New wodSFTPCom

sftp1.HostName = "x.y.z"
sftp1.Login = "xyz"
sftp1.Password = "abc"

sftp1.Blocking = True
sftp1.Connect

sftp1.RemoteOpen "/tmp/somefile", PermRead

MsgBox sftp1.RemoteRead(0, 0, -1, vbString)

sftp1.RemoteClose
sftp1.Disconnect