Newsgroups : Borland : borland.public.delphi.internet.winsock : 2005 Jun : TTcpClient vrs TIdTcpClient

www.cryer.info
Managed Newsgroup Archive

TTcpClient vrs TIdTcpClient

Subject:TTcpClient vrs TIdTcpClient
Posted by:"Gerry" (gpettipa..@hotmail.com)
Date:Tue, 21 Jun 2005 14:05:04

Hi,

I'm currently using a TTcpClient object to connect to a server and send
messages. I want to use a TIdTcpClient instead because I can use SSL. Here
is the code that I am currently using. This is inside of a thread. The
TTcpClient is named ClientSock.

var
   len : Integer;
   buf : array [0..c_iBuffSize] of Char;
   readflag : Boolean;
begin

   <loop stuff>

      if (not TcpThrd.terminated) and (ClientSock.Connected) then
      begin
         ClientSock.Select(@readflag,nil,nil,10);
         if (readflag) then
         begin
            Len := ClientSock.ReceiveBuf(buf,c_iBuffSize);
            if ( Len > 0 ) then
               ReadQueue.AddToQueue(Buf,Len)
            else
               ClientSock.Disconnect;
            end;
         end;
      end;

      if (not TcpThrd.terminated) and (ClientSock.Connected) then
      begin
         TcpThrd.Synchronize(UpdateFromQueue);
      end;

   <end loop stuff>


Can someone change this code so that I can use it with the TIdTcpClient? The
TIdTcpClient doesn't have Select() to test for socket activity. What would I
use in the TIdTcpClient to test for socket activity?

Thanks,

Very Confused

Replies:

www.cryer.info
Managed Newsgroup Archive