Page 1 of 1

ftp linux sample code. where of.........

Posted: Wed Nov 26, 2008 12:39 pm
by yunbg1
ftp linux sample cords will be a possibility where of buying and peels.

Posted: Wed Nov 26, 2008 1:19 pm
by Antonio Linares
I don't understand what you mean, sorry.

Could you explain with more detail your question ? thanks

Posted: Wed Nov 26, 2008 2:34 pm
by yunbg1
Hi Antonio.

LINUX File Transfer Protocol (FTP) Client.
Composition or method?

Windows sample program-> Sees the sample code.

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 )

Linux sample program -> Does to do how from linux ?
OS->Centos 5.0