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