Ver Mensaje Individual
  #1  
Antiguo 11-12-2004
Avatar de AGAG4
AGAG4 AGAG4 is offline
Miembro
 
Registrado: ago 2004
Ubicación: Los Mochis, Sinaloa, México
Posts: 1.420
Reputación: 23
AGAG4 Va por buen camino
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.

Última edición por AGAG4 fecha: 11-12-2004 a las 20:48:47. Razón: Corrección
Responder Con Cita