Hi, I'm Denis from Italy. Thanks for your great work!
I have implemented TTCPBlockSocket, how can I detect client disconnection? Can I use keep alive?

  ClientSocket:= TTCPBlockSocket.Create;
  try
    try
      ClientSocket.Socket:= Socket;
      while not Terminated *or SocketIsConnected (????)* do begin
        if ClientSocket.CanReadEx(100) then begin
          SetLength(AAByteIn, ClientSocket.WaitingData);
ByteIn:= ClientSocket.RecvBufferEx(@AAByteIn[0], Length(AAByteIn), 100);
          if ByteIn> 0 then begin
            RowIn:= '';
            for I:= 0 to ByteIn- 1 do RowIn:= RowIn+ Chr(AAByteIn[I]);
            SendLog(RowIn);
          end else break;
        end else Sleep(100);
      end;
      Except on e: Exception do begin
      end;
    end;
  finally
    ClientSocket.Free;
  end;


--
Denis Gottardello
Sintesi S.r.l.
049.9301135

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to