Before using FTP protocol, you should determine whether the server (you intend to upload/download files from) supports FTP protocol. Some servers do not. A CERN-based Web proxy server uses only Http protocol. You will have to use Http protocol to download files (ie, Http supports that), and can't use the Ftp functions of RexxINet.

To tell RexxINet what Ftp server you wish to connect to, you call the function InetConnect.

The first arg you pass is the name of some REXX variable that you wish to be set to a server handle that InetConnect creates for you. You do not need to know the details of what a server handle is, but you need to pass this server handle to InetClose after you've finished all communication with this server.

The second arg you pass is the IP address of the server. It can be specified like how you would normally type it into the Address bar of a browser, such as "ftp.microsoft.com", "msdn.microsoft.com", "www.borg.com", etc. Or it could be a dotted IP address like "9.23.19.63" if you know the real IP address. InetConnect() will resolve whatever you specify into the real IP address.

The third arg determines which type of protocol to use. For FTP, you'll pass "FTP".

The fourth and fifth args are the user name and password, respectively. For the Ftp protocol, you can omit these two args, and InetConnect will use a user name of "anonymous" and a password of the user's email address. This works logging into most FTP servers to read the contents of directories and perform download operations.

If InetConnect succeeds, it will return an empty string. If it fails, it will either return an error message, or raise some condition, depending upon how you've set the InetErr variable.

Here then is an example of a call to InetConnect in preparation of downloading a file from www.microsoft.com:

err = InetConnect("MicrosoftHandle", "www.microsoft.com", "FTP")
IF err \== "" THEN SAY err
Note: It's possible to connect to several different servers simultaneously, for example if you plan to transfer files between those servers. You need to make a call to InetConnect for each server so that you have a handle to each one. To change the "current server handle" between the two servers, pass the desired server's handle as the only arg to InetConnect.