Solved

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

Posted on 2006-07-04
1
1,939 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
Comment Utility
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now