InfoConnect VBA Guide
Attachmate.Reflection.Objects.Emulation.OpenSystems Library / FileTransfer Object / FTPStartServer Method
Specifies the user name. If this argument is null or empty, InfoConnect uses the current FTP User Name (which can be set using the FTP tab of the File Transfer dialog box, or using the FTPUserName property). If no FTP User Name has been set, InfoConnect displays the FTP Log In dialog box unless FTPServerOptions.NoLoginDialog is specified in the Options argument. If FTPServerOptions.NoLoginDialog is specified, FTPStartServer returns an error when UserName is not specified and no FTP User Name has been set. If FTPServerOptions.Anonymous is specified in the Options argument, the UserName argument is ignored.
Specifies the FTP password. If this argument is null or empty, InfoConnect uses the current FTP Password (which can be set using the FTP tab in the File Transfer dialog box, or using the FTPPassword property). If no password has been set, InfoConnect displays the FTP Log In dialog box unless FTPServerOptions.NoLoginDialog is specified in the Options argument. If FTPServerOptions.NoLoginDialog is specified, FTPStartServer generates an error when Password is not specified and no password has been set.
Specifies the host name or IP address. If this argument is null or empty, the current value of FTPHostName is used.
An FTPServerOption enumeration value that specifies additional, non-default behavior for the method. The possible values are: FTPServerOption.Anonymous Specifies that InfoConnect should use anonymous FTP when performing this transfer. FTPServerOption.NoLogInDialog Specifies that no FTP Log In dialog should appear if the FTP user name or password is not supplied. You can combine the two options by adding these values.
Example
In This Topic
    FTPStartServer Method
    In This Topic
    Connects to a host server in preparation for FTP file transfers.
    Syntax
    expression.FTPStartServer( _
       ByVal userName As String, _
       ByVal password As String, _
       ByVal hostName As String, _
       ByVal options As FTPServerOption _
    ) As ReturnCode
    where expression is a variable that represents a FileTransfer Object

    Parameters

    userName
    Specifies the user name. If this argument is null or empty, InfoConnect uses the current FTP User Name (which can be set using the FTP tab of the File Transfer dialog box, or using the FTPUserName property). If no FTP User Name has been set, InfoConnect displays the FTP Log In dialog box unless FTPServerOptions.NoLoginDialog is specified in the Options argument. If FTPServerOptions.NoLoginDialog is specified, FTPStartServer returns an error when UserName is not specified and no FTP User Name has been set. If FTPServerOptions.Anonymous is specified in the Options argument, the UserName argument is ignored.
    password
    Specifies the FTP password. If this argument is null or empty, InfoConnect uses the current FTP Password (which can be set using the FTP tab in the File Transfer dialog box, or using the FTPPassword property). If no password has been set, InfoConnect displays the FTP Log In dialog box unless FTPServerOptions.NoLoginDialog is specified in the Options argument. If FTPServerOptions.NoLoginDialog is specified, FTPStartServer generates an error when Password is not specified and no password has been set.
    hostName
    Specifies the host name or IP address. If this argument is null or empty, the current value of FTPHostName is used.
    options
    An FTPServerOption enumeration value that specifies additional, non-default behavior for the method. The possible values are: FTPServerOption.Anonymous Specifies that InfoConnect should use anonymous FTP when performing this transfer. FTPServerOption.NoLogInDialog Specifies that no FTP Log In dialog should appear if the FTP user name or password is not supplied. You can combine the two options by adding these values.

    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.

    Remarks
    Use FTPSendFile and FTPReceiveFile to transfer files. Use FTPStopServer to disconnect from the host FTP server. If your settings file is not already configured for FTP protocol, use TransferDefaultProtocol to set the transfer protocol, and TransferPreset to set the host server type. Most menu commands and all toolbar buttons are disabled when InfoConnect is in server mode.
    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