SendFTPFileEx

Für allgemeine Fragen zur Programmierung mit PureBasic.
Benutzeravatar
PIC18F2550
Beiträge: 121
Registriert: 29.04.2024 09:10
Computerausstattung: Server HP Proliant G7
PC AMD FX(tm)-9590, 64Gb Ram, 2x 2TB Raid5 SAS

Re: SendFTPFileEx

Beitrag von PIC18F2550 »

Ich hab alle auskommentierten Zeilen entfernt.
Der Fehler ist der zweite Aufruf von "OpenFTPEx" warscheinlich kann "CloseFTPEx" durch den Fehler nicht richtig geschlossen werden.

Code: Alles auswählen

Global PBEx_FTP

#PBEx_FTP_Version$ = "1.0.6.0"
#PBEx_FTP_Protocol_FTP = 1
#PBEx_FTP_Protocol_SFTP = 2
#PBEx_FTP_Protocol_FTPS_Implicit = 3
#PBEx_FTP_Protocol_FTPS_Explicit = 4

CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
  PBEx_FTP = OpenLibrary(#PB_Any, "PB.Ex_FTP_x86.dll")
CompilerElseIf #PB_Compiler_Processor = #PB_Processor_x64
  PBEx_FTP = OpenLibrary(#PB_Any, "PB.Ex_FTP_x64.dll")
CompilerEndIf
If PBEx_FTP
  Prototype OpenFTPEx(ID, Protocol, ServerName.p-Unicode, Port, User.p-Unicode, Password.p-Unicode, Charset, ErrorOutput)
  Global OpenFTPEx.OpenFTPEx = GetFunction(PBEx_FTP, "OpenFTPEx")
  Prototype CloseFTPEx(ID, ErrorOutput)
  Global CloseFTPEx.CloseFTPEx = GetFunction(PBEx_FTP, "CloseFTPEx")
  Prototype CheckFTPConnectionEx(ID, ErrorOutput)
  Global CheckFTPConnectionEx.CheckFTPConnectionEx = GetFunction(PBEx_FTP, "CheckFTPConnectionEx")
  Prototype IsFTPEx(ID, ErrorOutput)
  Global IsFTPEx.IsFTPEx = GetFunction(PBEx_FTP, "IsFTPEx")
  Prototype ExamineFTPDirectoryEx(ID, ErrorOutput)
  Global ExamineFTPDirectoryEx.ExamineFTPDirectoryEx = GetFunction(PBEx_FTP, "ExamineFTPDirectoryEx")
  Prototype FinishFTPDirectoryEx(ID, ErrorOutput)
  Global FinishFTPDirectoryEx.FinishFTPDirectoryEx = GetFunction(PBEx_FTP, "FinishFTPDirectoryEx")
  Prototype NextFTPDirectoryEntryEx(ID, ErrorOutput)
  Global NextFTPDirectoryEntryEx.NextFTPDirectoryEntryEx = GetFunction(PBEx_FTP, "NextFTPDirectoryEntryEx")
  Prototype FTPDirectoryEntryNameEx(ID, Output, ErrorOutput)
  Global FTPDirectoryEntryNameEx.FTPDirectoryEntryNameEx = GetFunction(PBEx_FTP, "FTPDirectoryEntryNameEx")
  Prototype.q FTPDirectoryEntrySizeEx(ID, ErrorOutput)
  Global FTPDirectoryEntrySizeEx.FTPDirectoryEntrySizeEx = GetFunction(PBEx_FTP, "FTPDirectoryEntrySizeEx")
  Prototype FTPDirectoryEntryTypeEx(ID, ErrorOutput)
  Global FTPDirectoryEntryTypeEx.FTPDirectoryEntryTypeEx = GetFunction(PBEx_FTP, "FTPDirectoryEntryTypeEx")
  Prototype FTPDirectoryEntryDateEx(ID, ErrorOutput)
  Global FTPDirectoryEntryDateEx.FTPDirectoryEntryDateEx = GetFunction(PBEx_FTP, "FTPDirectoryEntryDateEx")
  Prototype FTPDirectoryEntryAttributesEx(ID, ErrorOutput)
  Global FTPDirectoryEntryAttributesEx.FTPDirectoryEntryAttributesEx = GetFunction(PBEx_FTP, "FTPDirectoryEntryAttributesEx")
  Prototype GetFTPDirectoryEx(ID, Output, ErrorOutput)
  Global GetFTPDirectoryEx.GetFTPDirectoryEx = GetFunction(PBEx_FTP, "GetFTPDirectoryEx")
  Prototype SetFTPDirectoryEx(ID, DirectoryName.p-Unicode, ErrorOutput)
  Global SetFTPDirectoryEx.SetFTPDirectoryEx = GetFunction(PBEx_FTP, "SetFTPDirectoryEx")
  Prototype CreateFTPDirectoryEx(ID, DirectoryName.p-Unicode, ErrorOutput)
  Global CreateFTPDirectoryEx.CreateFTPDirectoryEx = GetFunction(PBEx_FTP, "CreateFTPDirectoryEx")
  Prototype DeleteFTPDirectoryEx(ID, DirectoryName.p-Unicode, ErrorOutput)
  Global DeleteFTPDirectoryEx.DeleteFTPDirectoryEx = GetFunction(PBEx_FTP, "DeleteFTPDirectoryEx")
  Prototype DeleteFTPFileEx(ID, FileName.p-Unicode, ErrorOutput)
  Global DeleteFTPFileEx.DeleteFTPFileEx = GetFunction(PBEx_FTP, "DeleteFTPFileEx")
  Prototype RenameFTPFileEx(ID, FileName.p-Unicode, NewFileName.p-Unicode, ErrorOutput)
  Global RenameFTPFileEx.RenameFTPFileEx = GetFunction(PBEx_FTP, "RenameFTPFileEx")
  Prototype ReceiveFTPFileEx(ID, RemoteFileName.p-Unicode, FileName.p-Unicode, IsAsynchron,  ErrorOutput)
  Global ReceiveFTPFileEx.ReceiveFTPFileEx = GetFunction(PBEx_FTP, "ReceiveFTPFileEx")
  Prototype SendFTPFileEx(ID, FileName.p-Unicode, RemoteFileName.p-Unicode, IsAsynchron, ErrorOutput)
  Global SendFTPFileEx.SendFTPFileEx = GetFunction(PBEx_FTP, "SendFTPFileEx")  
  Prototype FTPProgressEx(ID, PercentValue, TransferRate, EstimatedTime, ErrorOutput)
  Global FTPProgressEx.FTPProgressEx = GetFunction(PBEx_FTP, "FTPProgressEx")
  Prototype AbortFTPFileEx(ID, ErrorOutput)
  Global AbortFTPFileEx.AbortFTPFileEx = GetFunction(PBEx_FTP, "AbortFTPFileEx")  
EndIf
Define ErrorOutput$ = Space(128)
Define FileName$ = Space(#MAX_PATH)
Define Status
Repeat
  If OpenFTPEx(2, #PBEx_FTP_Protocol_FTPS_Explicit, "pic18f2550.lima-ftp.de", 21, "pic18f2550", "8wDzq7UZis", #PB_UTF8, @ErrorOutput$) ; wird in PB rot Markiert
    If SetFTPDirectoryEx(2, "default-websitexxxxxx", @ErrorOutput)   ; Fehlertest falscher Pfadname
    EndIf 
    CloseFTPEx(2, @ErrorOutput$)
  EndIf 
  Delay (10001 )  
Until Status=222
End
Was wird noch gebraucht?
Barbarus hic ergo sum, quia non intellegor ulli.
Ein Barbar bin ich hier, da ich von keinem verstanden werde.
ʎɐqǝ ıǝq ɹnʇɐʇsɐʇ ǝuıǝ ɹǝpǝıʍ ǝıu ǝɟnɐʞ ɥɔı ´uuɐɯ ɥo
Benutzeravatar
mk-soft
Beiträge: 3900
Registriert: 24.11.2004 13:12
Wohnort: Germany

Re: SendFTPFileEx

Beitrag von mk-soft »

HeX0R hat geschrieben: 05.03.2026 17:33 mit EnableExplicit wäre das vermutlich nicht passiert
Jetzt habe ich es auch gesehen :roll:
Alles ist möglich, fragt sich nur wie...
Projekte ThreadToGUI / EventDesigner V3 / OOP-BaseClass-Modul
Downloads auf MyWebspace / OneDrive
Benutzeravatar
PIC18F2550
Beiträge: 121
Registriert: 29.04.2024 09:10
Computerausstattung: Server HP Proliant G7
PC AMD FX(tm)-9590, 64Gb Ram, 2x 2TB Raid5 SAS

Re: SendFTPFileEx

Beitrag von PIC18F2550 »

:cry: Ich hätte richtig sehen sollen Im Gesamtprojekt habe ich es drinn aber im herauskopierten Teil nicht.

Nach 10 h sollte ich nicht mehr am schlepptop sitzen.

Der Fehler war dann schnell gefunden.

If SetFTPDirectoryEx(2, "default-websitexxxxx", @ErrorOutput$) ES FEHLTE DAS $.

Danke.
Barbarus hic ergo sum, quia non intellegor ulli.
Ein Barbar bin ich hier, da ich von keinem verstanden werde.
ʎɐqǝ ıǝq ɹnʇɐʇsɐʇ ǝuıǝ ɹǝpǝıʍ ǝıu ǝɟnɐʞ ɥɔı ´uuɐɯ ɥo
Benutzeravatar
HeX0R
Beiträge: 3070
Registriert: 10.09.2004 09:59
Computerausstattung: AMD Ryzen 7 5800X
96Gig Ram
NVIDIA GEFORCE RTX 3060TI/8Gig
Win11 64Bit
G19 Tastatur
2x 24" + 1x27" Monitore
Glorious O Wireless Maus
PB 3.x-PB 6.x
Oculus Quest 2 + 3
Kontaktdaten:

Re: SendFTPFileEx

Beitrag von HeX0R »

Bingo! :allright:
Tatsächlich finde ich diesen Thread mittlerweile sehr amüsant.
Hättest Du von Anfang an Code gepostet, mit dem wir was anfangen können, hätte ich gar nicht so vage geantwortet.
z.B. konnte ja keiner wissen, ob nicht irgendwo in Deinem (uns unbekanntem) Code ein
Define ErrorOutput.s = Space(128)
steht.
Dann wäre meine Vermutung natürlich hinfällig gewesen.

Amüsant finde ich es, weil meine Antwort durch mehrere Blumen selbst mk-soft verwirrt hat.
Das war natürlich nicht das Ziel, ich wollte viel eher Dir eine Lektion erteilen, weil tatsächlich NIEMAND den Fehler sicher sehen konnte.
Weil eben zuviele Informationen gefehlt hatten.

Na ja, Du hast eine weitere Frage damit freigespielt, eigentlich wollte ich Dich schon auf die Ignore-Ersatzbank setzen :mrgreen:
Benutzeravatar
mk-soft
Beiträge: 3900
Registriert: 24.11.2004 13:12
Wohnort: Germany

Re: SendFTPFileEx

Beitrag von mk-soft »

Auch wenn es mehr Aufwand ist, verwende IMMER EnableExplicit
Alles ist möglich, fragt sich nur wie...
Projekte ThreadToGUI / EventDesigner V3 / OOP-BaseClass-Modul
Downloads auf MyWebspace / OneDrive
Antworten