Autor Beitrag
sTk
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70

Win 2000, Win XP
Turbo Delphi Pro, D2005 PE, Lazarus
BeitragVerfasst: Mi 13.06.07 14:08 
Hallo,

ich programmiere mit TIdTelnet einen Telnet-Client, was auch soweit ganz gut funktioniert.

Wenn die die Verbindung unterbrochen wird, dann gibts eine Exception: '...Socket Error #10054 Connection reset by peer...'

Diese Exception will ich mit try except abfangen!

Nur in welchem Ereignis soll ich das platzieren, damit es auch greift?

Danke und Gruß,
sTk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70

Win 2000, Win XP
Turbo Delphi Pro, D2005 PE, Lazarus
BeitragVerfasst: Mo 25.06.07 15:03 
Das Problem besteht leider immer noch!

Wenn jemandem doch noch etwas einfällt, dann immer her damit!

Danke und Gruß,
Chryzler
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1097
Erhaltene Danke: 2



BeitragVerfasst: Mo 25.06.07 15:28 
Hat TIdTelnet nicht ein OnError-Ereignis oder so?
sTk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70

Win 2000, Win XP
Turbo Delphi Pro, D2005 PE, Lazarus
BeitragVerfasst: Mo 25.06.07 16:43 
Leider nein!

Wenn ich in die Hilfe zu den Indys schaue, dann wird ein EIdSocketError in einer EIdException ausgelöst.
Die Frage ist, wie kann ich das auswerten?

Oder kann man irgendwie anders feststellen, dass die Verbindung getrennt wurde?

Gruß,
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Mo 25.06.07 17:08 
Application.OnException -> F1

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
sTk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70

Win 2000, Win XP
Turbo Delphi Pro, D2005 PE, Lazarus
BeitragVerfasst: Di 26.06.07 15:04 
Hi,

ich hab das jetzt mal zum Testen so gemacht:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure TForm1.FormCreate(Sender: TObject);  
begin  
  Application.OnException := AppException;  
end;  
 
procedure TForm1.AppException(Sender: TObject; E: Exception);  
begin  
  Application.ShowException(E);  
  Application.Terminate;  
end;


Aber irgendwie springt die Anwendung nicht da rein.

Ist es so überhaupt korrekt?

Was ich auch nicht ausschließen will, dass ich noch irgend was falsch gemacht habe. Mache noch nicht all zu lange mit Delphi und das ist mein erstes größeres Projekt. Also Geduld ;)

Gruß,
sTk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70

Win 2000, Win XP
Turbo Delphi Pro, D2005 PE, Lazarus
BeitragVerfasst: Mi 27.06.07 08:39 
Noch etwas hab ich herausgefunden.
Wenn die Verbindung getrennt wird, dann tritt die Exception auf, geht aber an der obigen Prozedur vorbei.
Wenn ich jetzt mit dem Port weiter arbeiten will, dann tritt die gleiche Exception auf, nur mit dem Unterschied, dass sie jetzt von der Prozedur "gefangen" wird.
Ich verstehe das einfach nicht!

Gruß,