OpenFTP()

Syntax

Result = OpenFTP(#Ftp, ServerName$, User$, Password$ [, Passive [, Port]])
Description
Try to open a connection on the specified FTP server. If #PB_Any is used as '#Ftp' parameter, the new ftp number will be returned as 'Result'. 'ServerName$' has to be a valid ftp server adress. 'User$' and 'Password$' will be used to authenticate on the server. For public server, 'User$' can be set to "anonymous" and 'Password$' be let empty. By default the connection is opened in passive mode, as it's the most compliant mode (most PC have a firewall which will complain if a ftp connection is initialized in active mode). The default port is 21 but can be overriden with the 'Port' parameter.

If the connection to the server can't be successly completed, 'Result' will be 0.

InitNetwork() has to be called before using this command, as all the FTP commands are based on the network library.

Example:

  InitNetwork()
  
  If OpenFTP(0, "ftp.free.fr", "anonymous", "")
    Debug "Successfully connected"
  Else
    Debug "Can't connect to ftp.free.fr"
  EndIf

Supported OS

All

<- NextFTPDirectoryEntry() - Ftp Index - ReceiveFTPFile() ->