Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Jan : Problems with TIdTCPClient disconnecting after receiving first data

www.cryer.info
Managed Newsgroup Archive

Problems with TIdTCPClient disconnecting after receiving first data

Subject:Problems with TIdTCPClient disconnecting after receiving first data
Posted by:"Kiwi" (gl..@custommadesoftware.co.nz)
Date:Thu, 1 Feb 2007 07:53:10 +1300

Hi all,

I have an interesting problem in that when my client program connects to a
server app then requests data from the server - I get the data back but the
connection has been lost.  This doesnt happen all the time although on one
server it does happen all the time.

I am using Delphi 2006 and  Indy 10.1.5

On the client side I have a thread to handle all the reading - this thread
runs for the duration that tthe client is connected as the server app can
send messages back to all connected clients at any time.

      Mem.Clear;
      try
      B:= _Owner.Connected;  //At this point it is connected
       fReady:= True;
        _Owner.IOHandler.ReadStream(Mem, -1, False);
        fReady:= False;
      except
        Raise;
        _Owner.SocketError:= True;
        Synchronize(ProcessError);
        Exit;
      end;
      B:= _Owner.Connected; //At this point the result is false.  - Note no
exception is raised.


This is the code that the client uses to send the command to the server app:

          IOHandler.Write(Mem, 0, true);
          B:= IsConnected; // Returns true at this stage


Any ideas would be much appreciated as I have spent many hours trying to
figure at just what is wrong.

One other thing to note is that some computers the the client runs on seem
to be more prone to this problem than others.

Replies:

www.cryer.info
Managed Newsgroup Archive