Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Aug : Re: Testing for lost conection

www.cryer.info
Managed Newsgroup Archive

Re: Testing for lost conection

Subject:Re: Testing for lost conection
Posted by:"Gerhard Venter" (ieatspam4breakfast@spam.com)
Date:Mon, 21 Aug 2006 11:05:59

"Grant Brown" <grant@sitedoc.com.au> wrote in message
news:44e98cfa@newsgroups.borland.com...
> Hi,
> Is the following the best way in which to check for a lost connection
> when using a TIdTCPClient
>
> if IdTCPClient.Socket.ClosedGracefully = false then
> IdTCPClient.SendCmd(CmdStr_StdQuit);

try
    if IdTCPClient.Connected then
        IdTCPClient.SendCmd(CmdStr_StdQuit);
except
    on E: EIdConnClosedGracefully do
            ...handle error

    on E: EIdClosedSocket do
          ....handle error

    on E: Exception do
          ...handle error
end;

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive