Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Como Liberar el Buffer de Recepción del un TCustomIpClient???? (https://www.clubdelphi.com/foros/showthread.php?t=16787)

AGAG4 11-12-2004 20:45:06

Como Liberar el Buffer de Recepción del un TCustomIpClient????
 
Como puedo Liberar el Buffer de Recepción del un TCustomIpClient????

Lo que pasa es que estoy haciendo pruebas en el Demo Netchar que viene con el Delphi usando TcpServer y TcpClient, mando mensajes entre 2 Terminales reciben y envian Correctamente, pero exactamente en la Enviada número 40 de los 2 clientes se PARA,deja de recibir mensajes en los 2 clientes, he andado investigando como vaciar el buffer de recepción, pero no encuentro la forma de hacerlo, ó si alguien sabe que truco hay para hacerlo se los agradeceía muchisimo.

En la recepción de mensajes lo hago en el OnAccept del TcpServer:
Código Delphi [-]
procedure TForm1.TcpServer1Accept(sender: TObject;
  ClientSocket: TCustomIpClient);
var
  s: string;
begin
  s :=ClientSocket.Receiveln;
  while s <> '' do
  begin
    memRecv.Lines.Add(s);//Recibe en Memo
    s := ClientSocket.Receiveln;
  end;
  Label5.caption:=IntToStr(StrToInt(Label5.caption)+1);
  if StrToInt(Label5.caption)>=50 then begin
    memRecv.Clear;
  end;
end;

Y ya lo intente de esta otra forma:
Código Delphi [-]
procedure TForm1.TcpServer1Accept(sender: TObject;
  ClientSocket: TCustomIpClient);
var
  s: string;
  DataThread: TClientDataThread;
begin
   DataThread:= TClientDataThread.Create(true);
   DataThread.TargetList := memRecv.lines;
   DataThread.ListBuffer.Add('*** Conexión Aceptada ***');
  DataThread.ListBuffer.Add('Remote Host: ' + ClientSocket.LookupHostName(ClientSocket.RemoteHost) +
   ' (' + ClientSocket.RemoteHost + ')');
  DataThread.ListBuffer.Add('===== Inicio del Mensaje =====');

  s :=ClientSocket.Receiveln;
  while s <> '' do
  begin
   DataThread.ListBuffer.Add(s);
    s := ClientSocket.Receiveln;
  end;
  DataThread.ListBuffer.Add('===== Fin del Mensaje =====');
  Label5.caption:=IntToStr(StrToInt(Label5.caption)+1);
  DataThread.Resume;
end;

Que tengan buen día.


La franja horaria es GMT +2. Ahora son las 21:36:21.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi