Ver Mensaje Individual
  #3  
Antiguo 31-03-2013
Avatar de fenixariel
fenixariel fenixariel is offline
Miembro
 
Registrado: mar 2007
Posts: 77
Reputación: 18
fenixariel Va por buen camino
Código Delphi [-]

procedure TForm1.IdTCPServer1Connect(AContext: TIdContext);
begin
    Memo1.Lines.Add(DateTimeToStr(now) + ' ' + 'Connectado a : ' + AContext.Binding.PeerIP + '- Port:' + IntToStr(AContext.Binding.Port));
end;

procedure TForm1.IdTCPServer1Disconnect(AContext: TIdContext);
begin
    Memo1.Lines.Add(DateTimeToStr(now) + ' ' + 'Desconectado de : ' + AContext.Binding.PeerIP + '- Port:' + IntToStr(AContext.Binding.Port));
end;

procedure TForm1.IdTCPServer1Execute(AContext: TIdContext);
var
    Command: string;
    Size: integer;
    textoRecibido: string;
begin
    if AContext.Connection.Connected then
    begin
       
          Command := '';
          Command := AContext.Connection.Socket.ReadLn;
   
          Size := AContext.Connection.IOHandler.ReadLongInt(true);
          textoRecibido := AContext.Connection.IOHandler.ReadString(Size);
          AContext.Connection.IOHandler.WriteLn('Enviado');         
       
          Memo1.Lines.Add(DateTimeToStr(now) + ' - ' + AContext.Binding.PeerIP + ' : ' + Command);
    end;
end;


Probe enviandole mensajes desde Hercules tambien, pero solo puedo ver el momento que se conecta o desconecta el cliente pero no asi los datos enviados.



Saludos.
Responder Con Cita