PowerTCP FTP for .NET
Close Method (Ftp)
Example 



Gracefully closes the connection.
Syntax
Public Function Close() As Response
Dim instance As Ftp
Dim value As Response
 
value = instance.Close()
public Response Close()
public:
Response^ Close(); 

Return Value

Response object with the results of the command.
Remarks

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.

Example
This example demonstrates using the FTP control to retrieve a file using the FTP GET command.
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
See Also

Reference

Ftp Class
Ftp Members


PowerTCP FTP for .NET Documentation Version 6.1
© 2023 Dart Communications. All Rights Reserved.
Send comments on this topic