Árvore de páginas

Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.
Composition Setup
import.css=/download/attachments/6062824/tecnologia.css
Portuguese
Pagetitle
Classe TFtpClient
Classe TFtpClient

Classe destinada a comunicação com servidores de FTP (File Transfer Protocol).

Hierarquia

  • TFtpClient

Construtores

Inclusão de trecho
Classe TFtpClient - Construtores
nopaneltrue
Classe TFtpClient - Construtores

Propriedades

Inclusão de trecho
Classe TFtpClient - Propriedades
nopaneltrue
Classe TFtpClient - Propriedades

Métodos

Inclusão de trecho
Classe TFtpClient - Métodos
nopaneltrue
Classe TFtpClient - Métodos

Exemplos

Bloco de código
themeEclipse
languagecpp
titleExemplo 1
linenumberstrue
 #include "TOTVS.CH"
 User Function exampleFTP()
   Local nRet
   Local nI
   Local sRet
   Private oFTPHandle
   
   oFTPHandle := tFtpClient():New()
   nRet := oFTPHandle:FTPConnect("172.16.84.70")
   sRet := oFTPHandle:GetLastResponse()
   Conout( sRet )
   
   If (nRet != 0)
     Conout( "Falha ao conectar" )
     Return .F.
   EndIf
   
   oFTPHandle:GetCurDir(sRet)
   Conout(sRet)
   sRet := oFTPHandle:GetLastResponse()
   Conout(sRet)
   
   oFTPHandle:GetHelp("")
   sRet := oFTPHandle:GetLastResponse()
   Conout(sRet)
   
   nRet := oFTPHandle:GetMLCount()
   varinfo("GetMultiLineRespLineCount ret",nRet)
   
   for nI :=0 to nRet
     sRet := oFTPHandle:GetMLLine(nI)
     Conout(sRet)
   next
   
   nRet := oFTPHandle:MkDir("remote_folder")
   varinfo("Mkdir ret",nRet)
   sRet := oFTPHandle:GetLastResponse()
   Conout(sRet)
   
   nRet := oFTPHandle:Directory("*")
   varinfo("Directory ret",nRet)
   sRet := oFTPHandle:GetLastResponse()
   Conout(sRet)
   
   nRet := oFTPHandle:ChDir("remote_folder")
   varinfo("Chdir ret",nRet)
   sRet := oFTPHandle:GetLastResponse()
   Conout(sRet)
   
   oFTPHandle:GetCurDir(sRet)
   sRet := oFTPHandle:GetLastResponse()
   Conout(sRet)
   
   nRet := oFTPHandle:SendFile("arquivo.txt", "arquivo_ftp.txt")
   varinfo("SendFile ret",nRet)
   sRet := oFTPHandle:GetLastResponse()
   Conout(sRet)
   
   nRet := oFTPHandle:RenameFile("arquivo_ftp.txt", "arquivo2.txt")
   varinfo("RenameFile ret",nRet)
   sRet := oFTPHandle:GetLastResponse()
   Conout(sRet)
   
   nRet := oFTPHandle:DeleteFile("arquivo2.txt")
   varinfo("DeleteFile ret",nRet)
   sRet := oFTPHandle:GetLastResponse()
   Conout(sRet)
   
   nRet := oFTPHandle:CdUp()
   varinfo("CdUp ret",nRet)
   sRet := oFTPHandle:GetLastResponse()
   Conout(sRet)
   
   oFTPHandle:GetCurDir(sRet)
   sRet := oFTPHandle:GetLastResponse()
   Conout(sRet)
   
   nRet := oFTPHandle:ReceiveFile("image001.jpg", "image001_rec.jpg")
   varinfo("Receive ret",nRet)
   sRet := oFTPHandle:GetLastResponse()
   Conout(sRet)
   
   nRet := oFTPHandle:GetType()
   Conout("Transfer type = " +str(nRet))
   
   nRet := oFTPHandle:SetType(0)
   sRet := oFTPHandle:GetLastResponse()
   Conout(sRet)
   
   nRet := oFTPHandle:GetType()
   Conout("Transfer type = " +str(nRet))
   
   oFTPHandle:NoOp()
   sRet := oFTPHandle:GetLastResponse()
   Conout(sRet)
   
   nRet := oFTPHandle:Quote("PASV")
   varinfo("PASV ret",nRet)
   sRet := oFTPHandle:GetLastResponse()
   Conout(sRet)
   
   oFTPHandle:Close()
   sRet := oFTPHandle:GetLastResponse()
   Conout(sRet)
 Return

Veja também

Códigos de erro da classe TFtpClient, RFC 959