Connects to an FTP server
#include <FTPEx.au3>
_FTP_Connect ( $hInternetSession, $sServerName, $sUsername, $sPassword [, $iPassive = 0 [, $iServerPort = 0 [, $iService = $INTERNET_SERVICE_FTP [, $iFlags = 0 [, $fuContext = 0]]]]] )
$hInternetSession | as returned by _FTP_Open() |
$sServerName | Server name/ip. |
$sUsername | Username. |
$sPassword | Password. |
$iPassive | [optional] Passive mode. |
$iServerPort | [optional] Server port ( 0 is default (21) ) |
$iService | [optional] This can be one of the following constant values: $INTERNET_SERVICE_FTP - FTP service. $INTERNET_SERVICE_GOPHER - Gopher service. Available only on Windows XP, Windows Server 2003 R2 or earlier. $INTERNET_SERVICE_HTTP - HTTP service. |
$iFlags | [optional] Special flags. $INTERNET_FLAG_PASSIVE $INTERNET_FLAG_TRANSFER_ASCII $INTERNET_FLAG_TRANSFER_BINARY |
$fuContext | [optional] A variable that contains the application-defined value that associates this search with any application data. This is only used if the application has already called _FTP_SetStatusCallback() to set up a status callback function. |
Success: | an handle to connected session. |
Failure: | 0 and sets the @error flag to non-zero. |
The return handle must be closed with _FTP_Close().
_FTP_Close, _FTP_Command, _FTP_DirCreate, _FTP_DirDelete, _FTP_DirGetCurrent, _FTP_DirPutContents, _FTP_DirSetCurrent, _FTP_FileDelete, _FTP_FileGet, _FTP_FileGetSize, _FTP_FilePut, _FTP_FileRename, _FTP_ListToArray, _FTP_ListToArray2D, _FTP_ListToArrayEx, _FTP_Open, _FTP_SetStatusCallback
Search InternetConnect in MSDN Library.
#include <FTPEx.au3>
#include <MsgBoxConstants.au3>
Local $sServer = 'ftp.csx.cam.ac.uk' ; UNIVERSITY OF CAMBRIDGE ANONYMOUS FTP SERVER
Local $sUsername = ''
Local $sPass = ''
Local $hOpen = _FTP_Open('MyFTP Control')
Local $hConn = _FTP_Connect($hOpen, $sServer, $sUsername, $sPass)
If @error Then
MsgBox($MB_SYSTEMMODAL, '_FTP_Connect', 'ERROR=' & @error)
Else
; do something ...
EndIf
Local $iFtpc = _FTP_Close($hConn)
Local $iFtpo = _FTP_Close($hOpen)