Hi,
Hab ne Frage zum dem Workshop "FTP".
Bei mir funktioniert soweit ales.
Nur eins.
Die ProgressBar bei Downloadfile, da weiß ich nicht wo ich das ShowProgress rein machen soll.
Bei der Uploadfile kein Problem.
Hier euern Code zur Downloadfile
Der Code DownloadFile wo ich nicht weiß wo hin mit ShowProgress
' Datei downloaden
Friend Function DownloadFile(ByVal localfile As String, _
ByVal Serverfile As String, _
ByVal ServerFileSize As Long, _
Optional ByVal StartDownloadAt As Long = 0)
Dim TmpPort As Long
Dim TmpPortStr As String
' Servermodus auf Binär stellen
If SendCommand(OvermitBinary, CommandOk, CommandOk, _
CommandFail) = False Then Exit Function
NewUniquePort:
' Port öffnen (für das Empfangen von Daten)
TmpPort = 0
' Neuen Port ermitteln
Call GetNewPort(TmpPort, TmpPortStr)
' Neuen Port öffnen
With Downsock
.Close
.LocalPort = TmpPort
.Listen
End With
' neu geöffneten Port dem Server mitteilen
If SendCommand(SetPort & TmpPortStr, CommandOk, _
CommandOk, CommandFail, 0&, "Neuer Port geöffnet") = False Then
Exit Function
End If
' Download-Startposition setzen
If SendCommand(ResumeTransfere & StartDownloadAt, _
ResumingSupportet, CommandOk, _
CommandNotImplemented) = False Then Exit Function
' Progressbar einstellen
' siehe Workshop-Projekt
' lokale Datei öffnen/erstellen
FFile = FreeFile
Open localfile For Binary As FFile
Seek #FFile, StartDownloadAt + 1
' Download-Anfrage an Server senden
TAbort = False
TotalBytes = ServerFileSize
OvermittedBytes = StartDownloadAt
SendCommand Download & Serverfile, TransferComplete, _
TransferComplete, DataConnectionClosed, TransferStart
' Warten bis das letzte Datenpäckchen übermittelt
' wurde
Do
DoEvents
Loop Until Downsock.State <> sckConnected
' Socket schließen
Downsock.Close
' Neue Datei schließen
If FFile <> -1 Then
Close FFile
FFile = -1
End If
' Falls abgebrochen wurde
If TAbort = True Then
End If
' Falls die Verbindung zur Datenleitung nicht
' aufgebaut werden konnte nochmals versuchen
If LastServerCmd = DataConnectionError Then GoTo NewUniquePort
End Function Bei der UploadFile kein Problem nur bei der DownloadFile
Also vielleicht könnt mir jemand helfen
Wäre um jede Hilfe dankbar.
Im Voraus Danke
Mfg Patrick Hennig |