Chilkat  HOME  Android™  Classic ASP  C  C++  C#  Mono C#  .NET Core C#  C# UWP/WinRT  DataFlex  Delphi ActiveX  Delphi DLL  Visual FoxPro  Java  Lianja  MFC  Objective-C  Perl  PHP ActiveX  PHP Extension  PowerBuilder  PowerShell  PureBasic  CkPython  Chilkat2-Python  Ruby  SQL Server  Swift 2  Swift 3,4,5...  Tcl  Unicode C  Unicode C++  Visual Basic 6.0  VB.NET  VB.NET UWP/WinRT  VBScript  Xojo Plugin  Node.js  Excel  Go
 
      (VB.NET UWP/WinRT) Co:Z SFTP Binary File Download (from z/OS IBM Mainframe)Demonstrates how to download a binary file, such as a .zip, from a Co:Z SFTP server on a z/OS IBM Mainframe. Note: This requires Chilkat v9.5.0.76 or greater. 
 ' This example requires the Chilkat API to have been previously unlocked. ' See Global Unlock Sample for sample code. Dim sftp As New Chilkat.SFtp ' Connect to the SSH server. Dim hostname As String = "sftp.example.com" Dim port As Integer = 22 Dim success As Boolean = Await sftp.ConnectAsync(hostname,port) If (success <> True) Then Debug.WriteLine(sftp.LastErrorText) Exit Sub End If success = Await sftp.AuthenticatePwAsync("myLogin","myPassword") If (success <> True) Then Debug.WriteLine(sftp.LastErrorText) Exit Sub End If success = Await sftp.InitializeSftpAsync() If (success <> True) Then Debug.WriteLine(sftp.LastErrorText) Exit Sub End If ' To download a binary file from the Co:Z SFTP server, ' we must switch to binary mode in the following unconventional way. ' We pretend to fetch a directory listing for "/+mode=binary" ' This has the effect of putting the server in binary mode for transfers. Dim handle As String = Await sftp.OpenDirAsync("/+mode=binary") If (sftp.LastMethodSuccess <> True) Then Debug.WriteLine(sftp.LastErrorText) Exit Sub End If ' Download the "directory listing" (but it's not actually a directory listing, and we'll just discard it.) Dim dirListing As Chilkat.SFtpDir = Await sftp.ReadDirAsync(handle) If (sftp.LastMethodSuccess <> True) Then Debug.WriteLine(sftp.LastErrorText) Exit Sub End If ' Close the directory handle: success = Await sftp.CloseHandleAsync(handle) If (success <> True) Then Debug.WriteLine(sftp.LastErrorText) Exit Sub End If ' Download the binary file: Dim localFilePath As String = "c:/temp/test.zip" Dim remoteFilePath As String = "test.zip" success = Await sftp.DownloadFileByNameAsync(remoteFilePath,localFilePath) If (success <> True) Then Debug.WriteLine(sftp.LastErrorText) Exit Sub End If Debug.WriteLine("Success.")  | 
  ||||
© 2000-2022 Chilkat Software, Inc. All Rights Reserved.