Solved

HOW TO USE: TIDTCPCLIENT1.CheckForDisconnect() and TIDTCPCLIENT1.CheckResponse()

Posted on 2006-07-04
1
2,077 Views
Last Modified: 2012-05-05
how to use this functions below, somebody can give a example:

TIDTCPCLIENT1.CheckForDisconnect();
TIDTCPCLIENT1.CheckForGracefulDisconnect();
TIDTCPCLIENT1.CheckResponse()
0
Comment
Question by:rafaelrgl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 17

Accepted Solution

by:
TheRealLoki earned 500 total points
ID: 17039701
TIDTCPCLIENT1.CheckForDisconnect();
is used internally in the "Connected" property (and therfore also in the "Disconnect" method)
and various "Read" methods.
You do not need to call this yourself.

TIDTCPCLIENT1.CheckForGracefulDisconnect();
Determines if the peer has been gracefully disconnected
it calls ReadFromStack with a very short timeout, which subsequently validates the connection.
It is safe to call this before a Read, but you can still get a disconnect while receiving data
e.g.
try
  IdTCPClient1.CheckForGracefulDisconnect(true);
  S := IdTCPClient1.ReadLn;

this could return the following exceptions
except
  on EIdConnClosedGracefully do // connection closed gracefully
  on EIdNotConnected: // not connected....
end;


TIDTCPCLIENT1.CheckResponse()
  this just looks to see if 1 smallint is in an array of allowed smallints
e.g. if "2" is in [0,1,3,4,5]
I've only ever seen this used internally by Indy, but it's a compact function that you could use for your own purposes, although I don't see any obvious place in the Indy stuff I do.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi Form ownership 4 151
how to send memory stream from ics Client To ics server ? 11 203
How to build JSON File in Delphi 6 3 85
Automatic field translation delphi 10.2 6 39
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question