Dart.Ftp Namespace > Ftp Class > Connect Method : Connect(String) Method |
Public Overloads Function Connect( _ ByVal hostNameOrAddress As String _ ) As Response
Dim instance As Ftp Dim hostNameOrAddress As String Dim value As Response value = instance.Connect(hostNameOrAddress)
public Response Connect( string hostNameOrAddress )
public: Response^ Connect( String^ hostNameOrAddress )
Sets Session.RemoteEndPoint.HostNameOrAddress to the provided value and calls Connect.
Authenticate or Authenticate(String,String) must be called after this method if a login is desired. Otherwise, the user must send their own custom commands to authenticate with the server.
SSL encryption is negotiated if Session.Security.EncryptControl is EncryptControl.Implicit.
private void button1_Click(object sender, EventArgs e) { //Connect to the FTP Server. ftp1.Connect(myServer); //Login with user credentials ftp1.Authenticate(myUsername, myPassword); //Retrieve a file. ftp1.Get("testfile.txt", Path.Combine(myLocalDirectory, "testfile.txt"), Synchronize.Off); //Close the connection. ftp1.Close(); }
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button1.Click 'Connect to the FTP Server. ftp1.Connect(myServer) 'Login with user credentials ftp1.Authenticate(myUsername, myPassword) 'Retrieve a file. ftp1.Get("testfile.txt", Path.Combine(myLocalDirectory, "testfile.txt"), Synchronize.Off) 'Close the connection. ftp1.Close() End Sub