Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Dec : Re: closing an application over the network
| Subject: | Re: closing an application over the network |
| Posted by: | "Remy Lebeau (TeamB)" (no.spam@no.spam.com) |
| Date: | Wed, 19 Dec 2007 14:40:00 |
"soonic" <xxsoonic@op.pl> wrote in message
news:47699896@newsgroups.borland.com...
> I have trouble of making my application.terminate
> when the connection is broken on server side.
OnDisconnected is not an unsolicted event. It is only fired when
Disconnect() is called, or when CheckForDisconnect() detects a graceful
disconnect while performing a blocking read/write operation. So you have to
initiate an operation in your own code in order for OnDisconnected to do
anything. It will never fire by itself.
> When I use Button to close application it works (sender is nil)
Sure, because you are forcing Terminate() to be called immeidately.
> ...but when the IdTCPClientDisconnected procedure is called in
> run-time because the connection broke but it self then it doesn't
> close my application.
Yes, it will - provided the event is ever fired to begin with.
> How to make the program that when it's closed it deletes by
> it self? Is this possible?
Delete what? Your question is too vague.
Gambit