jeu. 11 avril 2013, 12h33
Mike Gagnon
Canada
atoutfox.public.association
Re: FTP ACTIF
Voici un court article sur le sujet
#DEFINE INTERNET_INVALID_PORT_NUMBER 0
#DEFINE INTERNET_SERVICE_FTP 1
#DEFINE INTERNET_FLAG_PASSIVE 0x08000000
hConnection = InternetConnect(m.hInternet, m.host,;
INTERNET_INVALID_PORT_NUMBER,;
m.usr, m.cPsw, INTERNET_SERVICE_FTP, m.nFlags, 0)
The host value is either server name like "ftp.mycompany.com" or IP address, for example, "11.0.1.45".
The user name and password don't need to be explained. Get them from FTP server admin or use anonymous access to connect to public FTP servers.
There are two choices for nFlags parameter. Use zero for active data connection and INTERNET_FLAG_PASSIVE for passive data connection.
A few words about active and passive FTP data connections ..top
FTP server transfers data and commands through separate ports. Speaking very generally the active data connection is characterized by using predefined ports 20 and 21 used on the server side. As well the server initiates data connection to client's data port.
During the passive data connection the client initiates connection to port 21 on the server and then requests the number of data port (by issuing the PASV command). Now the client initiates data connection to this port to transfer data.
By choosing corresponding flag when calling the InternetConnect function you define whether the connection is going to be active or passive.
To know more about FTP ports and data connections read Active FTP vs. Passive FTP, a Definitive Explanation article by Jay Ribak on Slacksite.Com
Permalink : http://www.atoutfox.org/nntp.asp?ID=0000011708