<< back to sysax.com Product page

3.1. Establishing a connection

To initiate a connection to a remote host, the address of the host, username and password must be set before calling the corresponding connection command. The Host method is used to set the host address. The HostEnc method is used to set an encrypted value for the host address. The User method is used to set the username. The UserEnc method is used to set an encrypted value for the username. The Pass method is used to set the password for the user account. The PassEnc method is used to set an encrypted value for the password.

The FTPConnect method can be used to establish a regular FTP connection with the remote host. The default port is 21. A different port can be explicitly specified if needed. The FTPConnectSSL method is used to establish an explicit secure FTPS connection while the FTPConnectSSLI method can be used to establish an implicit secure FTPS connection. The FTPConnectSSH method can be used to establish a secure SSH connection.

Exhibit 3.1. IDL Definition of methods to establish connection with a remote host


  HRESULT Host    ([in] BSTR b_hostname);
  HRESULT HostEnc ([in] BSTR b_hostname_enc);
  HRESULT User    ([in] BSTR b_username);
  HRESULT UserEnc ([in] BSTR b_username_enc);
  HRESULT Pass    ([in] BSTR b_password);
  HRESULT PassEnc ([in] BSTR b_password_enc);

  HRESULT FTPConnect     ([in, defaultvalue(21)] UINT n_port);
  HRESULT FTPConnectSSL  ([in, defaultvalue(21)] UINT n_port);
  HRESULT FTPConnectSSLI ([in, defaultvalue(990)] UINT n_port);
  HRESULT FTPConnectSSLC ([in, defaultvalue(21)] UINT n_port);
  HRESULT FTPConnectSSH  ([in, defaultvalue(22)] UINT n_port);


Exhibit 3.2. Example usage of methods to establish connection with a remote host (VBScript)


app.Host = "localhost" 'hostname or IP address of remote site
app.User = "test"      'account username
app.Pass = "test"      'password for account

app.FTPConnect         'connect to site (default port is 21 for)
app.FTPConnectSSH 27   'connect to site using SFTP on port 27


The FTPDisconnect method can be used to disconnect from the remote host.

Exhibit 3.3. IDL Definition of method to disconnect from a remote host


HRESULT FTPDisconnect ();


Exhibit 3.4. Example usage of method to disconnect from a remote host (VBScript)


'disconnect from the remote site
app.FTPDisconnect