Entwickler-Ecke

Internet / Netzwerk - Fehler mit FTP


Shadowdragon - Do 27.02.03 16:28
Titel: Fehler mit FTP
Also, hab die INDY-Komponente installiert, funzt alles wunderhübsch.

So, jetzt will ich, dass ich mit einer IDFTP-Komponente auf den FTP-Server zugreife und eine Textdatei hole. Dafür hab ich 2 Buttons, einen für's Hochladen (Button2) und einen fürs Runterladen (Button1).

Code soweit:

Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
procedure TForm1.Button1Click(Sender: TObject);
begin
try
idftp1.Get('www.meineseite.de/textfile.txt', 'C:\textfile.txt')  ;
except showmessage('Fehler bei Übertragung')
end;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
try
idftp1.Put('C:\textfile.txt')
except showmessage('Fehler bei Übertragung')
end;
end;

end.


User und Passwort sind eingetragen und stimmen.

Beim Programmstart springt die Anwendung in die IDFTP.pas über und zeigt die Meldung
Zitat:
Destination file already exists

Das sollte aber dem Programm doch egal sein, wenn ich die Datei RUNTERLADEN will!

Und beim Button2, also dem Hochladen-Button, passiert folgendes:

Zitat:
Connection closed gracefully

Dann hält es wieder in der IDFTP.pas an, Kommentar is folgend:

If this is a CLIENT (isses ja!)
-------------------
The server side of this connection has disconnected normaly but your client has attempted
to read or write to the connection. You should trap this error using a try..except.
Please see the help file for possible further information.
------------------

Was mache ich da falsch? Danke schonmal im Voraus, bin halt ein N00b :(


maximus - Do 27.02.03 18:23

Zitat:
Destination file already exists

...klingt so als ob 'C:\textfile.txt' auf deiner platte schon existiert!

Zitat:
If this is a CLIENT (isses ja!)
-------------------
The server side of this connection has disconnected normaly but your client has attempted
to read or write to the connection. You should trap this error using a try..except.
Please see the help file for possible further information.

...hmm :? Sieht so aus als ob die verbindung unterbrochen ist und du trotzdem schreibst! vielleicht reconnecten.

Reagiertst du auf das disconnect event? und hast du ne abfrage ob die connection noch steht? Hast du nen schutz-block (try/except/finally) wenn du hochlädst?

mfg mx.