?
Solved

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

Posted on 2006-07-04
1
Medium Priority
?
2,131 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 2000 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
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…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Suggested Courses
Course of the Month11 days, 13 hours left to enroll

752 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