Connect

Connect is used to determine the hostname or IP address and the port of the FTPA protocol used to transfer files between network computers. server.

Syntax

FTPObject connect (STRING hostname, LONG port, BOOL PassiveMode STRING user, STRING password)

Where:

  • Hostname - can be the IP address or the hostname (example: www.gfi.com)
  • Port - Port number – an Integer between 1 and 65535
  • PassiveMode - is either TRUE or FALSE. False sets the mode to Active.
  • User - FTP username. For anonymous logon specify username as anonymous.
  • Password - FTP password. For anonymous logon use an e-mail address such as (lnss@gfi.com) as the password.
Returns

FTP Object.

Example

An example which echoes the current FTP working directory:

Function Main

Dim FTPobj as Object

ip = "127.0.0.1"

port = 21

mode = FALSE

username = "anonymous"

password = "test@lnss.com"

Set FTPobj=FTP.Connect (ip,21,mode,username,password)

cdir = FTPobj.GetCurrentDirectory

echo cdir

End Function