Connect Method (FTP)


10.2, PLBCMP GUI Only

 

The Connect method establishes a connection and logs the user into a FTP Server. This method uses the following format:

 

[label]

{object}.Connect

[GIVING {return}] using [*Host=]{host}:

 

 

[*User=]{user},[*Password=]{password}[:

 

 

[*Flags=]{flags}]

 

Where:

label

Optional. A Program Execution Label.

object

Required. A FTP that has been declared.

return

Optional. A Numeric Variable that returns the pass or failure values for the execution of the method.

host

Required. A Character String Variable or string literal that specifies the host name or IP address with an optional port number used to make a socket connection to the FTP server running at the host. If the port number is not specified, the default port is 21.

user

Required. A Character String Variable or string literal that specifies the user name.

password

Required. A Character String Variable or string literal that specifies the user password.

flags

Optional. A Numeric Variable or decimal number that specifies a bit mask value that can control the behaviors of this method.

Flags Affected: OVER, ZERO

Note the following:

  1. The ZERO flag is set if the {return} value is zero which indicates that the method executed successfully.

  2. The OVER flag is set if the {return} Numeric variable is too small to receive the pass or fail value without being truncated.

  3. The {host} string can be formatted as follows:

  4.  

    {hostname}[:portnum]

     

    or

     

    {ipaddress}[:portnum]

Example:

 

'ftp.myserver.com' or '12.345.678.90'

 

In this case, the default port number of '21' is used.

 

'ftp.myserver.com:21'" or '12.345.678.90:21'

 

In this case, the port number of '21' is specified.

 

  1. The {flags} value defines a set of bit-mask values that control the behavior of this function. They are as follows:

  2.  

    Values

    Description

    0x0

    The default behavior is to create a normal socket connection to a FTP server.

    0x1

    If this bit is turned on, an explicit SSL socket connection to a FTP server is made.

    0x2

    This bit only takes affect when it is used with either the 0x01 (explicit SSL) or the 0x04 (implicit SSL) bit values. This 0x02 bit value invokes SSL reuse to maximize the security and performance.

    0x4

     If this bit is turned on, an implicit SSL socket connection to a FTP server is made.

     

    1. The {return} values are defined as follows:

    2.  

      Values

      Description

      0

      Method executed successfully with no errors.

      3

      Unable to connect to FTP server.

      4

      Unable to login to FTP server using the USER and PASSWORD settings.

      5

      SSL connection failure.

 

 

See Also: FTP Control Methods, Method Syntax



PL/B Language Reference Close Method (FTP) Debug Method (FTP)