Autor Beitrag
O'rallY
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 563



BeitragVerfasst: Mo 26.08.02 12:15 
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
...
        try
           ClientSocket1.Address := ip;
           ClientSocket1.Active := true;
        except
           ShowMessage('Fehler!');
        end;
...


Trotz dieser Fehlerbehandlung erscheint immer noch die eine Standardfehlermeldung und nicht die von mir definierte. Kann mir einer helfen?
Ex0rzist
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 550

Win XP Prof.
Mandrake 10.0

D6
BeitragVerfasst: Mo 26.08.02 12:28 
Hallo O'Rally,

kann es sein, dass du das ganz nur in der IDE getestet hast?
Die ist nämlich nicht besonders großzügig mit Exceptions. :wink:

Ansonsten verusche doch einfach die Standardfehlerereignisse zu verwenden (z.B.: OnClientError o.Ä.).


______________

Ex0rzist
O'rallY Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 563



BeitragVerfasst: Mo 26.08.02 12:59 
Zitat:

Ansonsten verusche doch einfach die Standardfehlerereignisse zu verwenden (z.B.: OnClientError o.Ä.).


Hab ich auch schon versucht (v)

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.ClientSocketError(Sender: TObject;
  Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;
  var ErrorCode: Integer);
begin
        ShowMessage(IntToStr(ErrorCode));
end;


Es wird zwar immer die Messagbox angezeigt, aber danach kommt wieder die Standardbox:
Asynchronous socket error "ErrorCode"
lemming
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 470

Mac OS 10.3.1
Delphi 6 Pro, Kylix 3
BeitragVerfasst: Mo 26.08.02 13:06 
Hallo O'rallY, dieses Problem lässt sich nicht mit try..except lösen. Ich habe das meinen Socket-Anwendungen immer so gelöst:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure OnError(Sender: TObject; E: Exception);
begin
  Main.MemoDebug.Lines.Add(E.Message);
end;

procedure TMain.FormCreate(Sender: TObject);
begin
  Application.OnException := OnError;
end;
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: Mo 26.08.02 13:06 
Das Ereignis OnError tritt ein, wenn der Socket eine Verbindung nicht herstellen, benutzen oder schließen kann.

property OnError: TSocketErrorEvent;

Beschreibung

In einer Behandlungsroutine für OnError können Sie auf Fehler reagieren, die in Zusammenhang mit einer Socket-Verbindung auftreten. Wenn die Ereignisbehandlungsroutine für OnError die Fehlerbedingung erfolgreich behandeln konnte, setzen Sie den Parameter ErrorCode auf 0, damit keine ESocketError-Exception ausgelöst wird.
O'rallY Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 563



BeitragVerfasst: Mo 26.08.02 13:08 
Danke. Ich liebe dieses Forum :wink: :D