ftp linux sample code. where of.........
Posted: Wed Nov 26, 2008 12:39 pm
ftp linux sample cords will be a possibility where of buying and peels.
www.FiveTechSoft.com
https://fivetechsoft.com/forums/
Code: Select all
hLib := LOADLIB32( "wininet.dll" )
hInternet := INETOPEN( "Anystring", 0, 0, 0, 0 )
hConnect := INETCONNECT( hInternet, cFtpSite, 21, cFtpUser, cFtpPassword, INTERNET_SERVICE_FTP, 0, 0 )
nSize := ftp_dir(cFTPRemote)
nFileSize := 0
if file(cFtpLocal)
nFileSize := FSize(cFtpLocal)
if nFilesize != nSize
ferase(cFtpLocal)
else
lReturn := .t.
iNetClose( hConnect )
iNetClose( hInternet )
FreeLib32( hLib )
RETU lReturn
endi
endi
if nSize == 0
lReturn := .f.
else
hFile := FtpOpenFile( hConnect, cFtpRemote, GENERIC_READ, FTP_TRANSFER_TYPE_BINARY, 0 )
if hFile == 0
lReturn := .f.
else
handle := fcreate(cFtpLocal)
if handle == -1
RETU (.f.)
endi
cBuffer := Space( nBytes )
co1 := 0
do while .t.
lReturn := InternetReadFile(hFile, cBuffer, nBytes, @nRead)
if lReturn == .f.
exit
endi
fwrite(handle, cBuffer, nRead)
nProgress := nProgress + nRead
if nProgress >= nSize
exit
endi
endd
fclose(handle)
iNetClose( hFile )
endi
endi
iNetClose( hConnect )
iNetClose( hInternet )
FreeLib32( hLib )