|
This command opens a FTP session so that remote file operations may be performed.
session | The FTP session number to be opened. Up to 10 sessions may be open at any time. The session number identifies which FTP session is being accessed. The session number ranges from 1 to 10. |
url$ | This string contains the url or IP address of the FTP server |
port | This is the FTP port number. It is almost always 21. |
username$ | This is the login user name. |
password$ | This is the login password. |
timeout | This is an optional parameter which specifies the timeout for all FTP commands. If not specified it defaults to 10 seconds. Timeout is in milliseconds. |
For example:
FtpOpen 1, "myftp.com", 21, "myname", "mypass"
Print FtpGetReply$(1)
err$ = FtpGetError$(1)
if err$ <> "" then Print "Error - "; err$
if FtpGetState(1) = 1 then
Print "Ftp Open"
else
Print "Ftp Open Failed"
endif
FtpClose 1
After a FtpOpen it is important to check if the open succeeded. All internet connections are subject to interruption at any time so check the FtpGetError$(n) after each FTP command you execute.
|