Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Oct : Re: Best method of keep-alive?
| Subject: | Re: Best method of keep-alive? |
| Posted by: | "Remy Lebeau (TeamB)" (no.spam@no.spam.com) |
| Date: | Tue, 3 Oct 2006 10:11:19 |
"Jamie Dale" <j.dale@turboz.net> wrote in message
news:452286c3@newsgroups.borland.com...
> I'm using Indy 8. ReadLnTimedOut doesn't exist. Do you have
> any other ideas please?
Upgrade to Indy 9 or 10. Seriously. Indy 8 is no longer supported.
> Should my client set a timer to expect a response within?
The ReadTimeout already handles that for you. If you send a command, and
the response does not arrive in a timely manner, then disconnect when the
timeout elapses. 'PING' is just another command like any other, just one
that you send at regular intervals during idle periods.
> Seeing as I'm now going to do this from the client end, I'm supposing
> that my client should activate a timer when it sends 'ping' and then
> close the connection if the timer expires before a reply is received?
The only time you would need to use a timer in this situation is if you are
handling responses asynchronous, such as in a separate reader thread.
Otherwise, if you are reading the response in the same thread that sends a
command, then the ReadTimeout is sufficient.
> I also noticed that the ReadLn procedure seems to be the same
> in TIdTCPClient.
TIdTCPClient derives from TIdTCPConnection. ReadLn() is implemented in
TIdTCPConnection, not in TIdTCPClient.
Gambit