Solved

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

Posted on 2006-07-04
1
2,010 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
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Strange code, can use it, but i cant figure out what it does. 3 60
Delphi cmd execution 6 60
Magic Software info 18 130
tvirtualstringtree freeze when load too manny images 10 60
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

786 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