All wodCrypt (12) wodSSH (10) wodSFTP (23) wodSSHServer (1) wodSSHTunnel (11) wodSSHpackage wodSFTPdll wodSSH.NET (10) wodSFTP.NET (24) wodFtpDLX.NET (22) wodWebServer.NET (10) wodAppUpdate (13) wodHttpDLX (8) wodFtpDLX (22) wodTelnetDLX wodFTPServer (3) wodWebServer (10) wodVPN wodXMPP (13) | All ** [Visual Basic] ** [C#] ** [VB.NET] ** Read chunk from a text file using SFTP protocol
VB code
Dim wodSFTP1 As wodSFTPCom Set wodSFTP1 = New wodSFTPCom 'Authenticate with server using hostname, login, password. wodSFTP1.HostName = "your_hostname" wodSFTP1.Login = "your_login" wodSFTP1.Password = "your_password" wodSFTP1.Blocking = True 'Use synchronous connections wodSFTP1.Connect 'First we need to open remote file for reading. wodSFTP1.RemoteOpen "/home/somefolder/somefile.txt", PermRead 'Then we will use RemoteRead and read chunk of remote file. 'In this example we will begin to read file from fifth character 'and read following ten characters. Debug.Print (wodSFTP1.RemoteRead(4, 0, 10, vbString)) 'Close remote file when we are done. wodSFTP1.RemoteClose VB.NET code
Dim wodSFTP1 As New WeOnlyDo.Client.SFTP 'Authenticate with server using hostname, login, password. wodSFTP1.Hostname = "your_hostname" wodSFTP1.Login = "your_login" wodSFTP1.Password = "your_password" wodSFTP1.Blocking = True 'Use synchronous connections wodSFTP1.Connect() Dim bResult As Byte() Dim sResult As String Dim enc As New System.Text.ASCIIEncoding() 'First we need to open remote file for reading. wodSFTP1.RemoteOpen("/home/somefolder/somefile.txtt", WeOnlyDo.Client.SFTP.RemotePermissions.Read) 'Then we will use RemoteRead and read chunk of remote file. 'In this example we will begin to read file from fifth character and read following ten characters. bResult = wodSFTP1.RemoteRead(4, 10) 'Now we need to convert result from Byte to String. sResult = enc.GetString(bResult) 'Finally we can print output. Console.WriteLine(sResult) 'Close remote file when we are done. wodSFTP1.RemoteClose() C# code
WeOnlyDo.Client.SFTP wodSFTP1 = new WeOnlyDo.Client.SFTP(); //Authenticate with server using hostname, login, password. wodSFTP1.Hostname = "your_hostname"; wodSFTP1.Login = "your_login"; wodSFTP1.Password = "your_password"; wodSFTP1.Blocking = true; //Use synchronous connections wodSFTP1.Connect(); byte[] bResult; string sResult; System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); //First we need to open remote file for reading. wodSFTP1.RemoteOpen("/home/somefolder/somefile.txt", WeOnlyDo.Client.SFTP.RemotePermissions.Read); //Then we will use RemoteRead and read chunk of remote file. //In this example we will begin to read file from fifth character and read following ten characters. bResult = wodSFTP1.RemoteRead(4, 10); //Now we need to convert result from Byte to String. sResult = enc.GetString(bResult); //Finally we can print output. Console.WriteLine(sResult); //Close remote file when we are done. wodSFTP1.RemoteClose(); |