InfoConnect VBA Guide
Attachmate.Reflection.Objects.Emulation.OpenSystems Library / FileTransfer Object / FTPStopServer Method
Example
In This Topic
    FTPStopServer Method
    In This Topic
    Disconnects from a host server that was connected by FTPStartServer.
    Syntax
    expression.FTPStopServer() As ReturnCode
    where expression is a variable that represents a FileTransfer Object

    Return Value

    One of the following ReturnCode enumerated values.

    Member Description
    Cancelled Cancelled.
    Error Error.
    PermissionRequired Permission is required.
    Success Success.
    Timeout Timeout condition.
    Truncated The text is truncated.

    Example
    'This example transfers a file from an FTP server to a local file
    Sub FileReceiveExample()
     
        On Error GoTo Handler
        Dim rcode As ReturnCode
        
        'Set the date as the current time
        Dim mydate As Date
        
        'Connect to the host server, leaving the password empty - you'll need to log on to the session before you run the macro
        ThisTerminal.FileTransfer.FTPStartServer "your_user_name", "", "your_ftp_server", FTPServerOption_None
        
        'Transfer a file on the server as an ASCII file to a local file and overwrite the file if it exists.
        'Specify to transfer the file regardless of whether it was created or modifed before or after the current time
        'This file name does not include wildcards so we don't need to exclude any files.
        rcode = ThisTerminal.FileTransfer.FTPReceiveFile("C:\test\local_file.txt", "file_on_ftp_server", TransferTypeOption_Ascii, DestinationFileExistsOption_Overwrite, mydate, mydate, "")
        
        'Stop the host server
        ThisTerminal.FileTransfer.FTPStopServer
        
        Exit Sub
        
    Handler:   
            MsgBox Err.Description
     
    End Sub
    See Also