Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Dec : Re: closing an application over the network

www.cryer.info
Managed Newsgroup Archive

Re: closing an application over the network

Subject:Re: closing an application over the network
Posted by:"soonic" (xxsoon..@op.pl)
Date:Thu, 20 Dec 2007 21:05:57

> You shouldn't really be relying on the OnDisconnected event to begin with.
> Indy is not an event-driven library.  When you call Disconnect() yourself,
> then you can obviously call Terminate() at the same time as well.  As for
> when you are not closing the socket yourself yet, an exception is thrown
> when a disconnect occurs during a reading/writing operation, so simply
> wrap your reading/writing code in a try..except block to handle it.
>

well, I'm still missing something.
in client's unit (NetUnit.pas) I got a procedure (it's made simple to give
only idea what is where:

procedure TRecordSend.ReadFrom(Cc: TIdTCPConnection);
begin
    try
       iStepTime := Cc.ReadInteger;
    except
        MainForm.Terminate;
    end;
end;

(mainform.pas)
procedure TMainForm.Terminate;
begin
  Application.Terminate;
end;

When I break connection on Server side, my exception in client unit will
fire up, but it won't Terminate Client application. I can't find a solution.
I need to close the whole application when it loses the connection with the
server.

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive