Dart.Ftp Namespace > Ftp Class : Close Method |
This method sends a QUIT message, reads until the stream is empty, and closes the connection.
Note: Some servers using an encrypted control connection will not shutdown the SSL connection gracefully. In this case an IOException will be generated while closing, which can be safely ignored.
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