Te comento que funciono, y que si le colocas implementation da error al compilar dice que falta un punto (.)
aca te muestro mas o menos como quedo el programa...
lo que hace es enviar un mensaje , y con el evento que creamos cuando recibe una respuesta la escribe en un archivo
lo que esta en rojo es lo que me daba problemas y ahora funciona,
MUCHAS GRACIAS!!!
Código Delphi
[-]
program ActualizaHoraMD400_Console;
{$APPTYPE CONSOLE}
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, etc...
type
TEvents = class
class procedure IdLogEvent1ReceivedNEW(ASender: TComponent; const AText, AData: String);
end;
var
TcpClient1: TIdTCPClient;
IdLogEvent1: TIdLogEvent;
Relojes : array of TReloj;
archLog : String;
cuanto : integer;
const Const_Un_Minuto : Real = 0.00069445; FUNCTION Loguear(mensaje : String; archivoLog : String = sys_directorio + 'archivo.log') : Boolean;
var
Arch : TextFile;
begin
try
result := TRUE;
try
AssignFile(Arch, archivoLog);
if NOT FileExists(archivoLog) then Rewrite(Arch) else
Append(Arch); finally
Writeln(Arch, mensaje); Flush(Arch); CloseFile(Arch); end;
except
Result := FALSE;
end;
end;
Class PROCEDURE TEvents.IdLogEvent1ReceivedNEW(ASender: TComponent; const AText, AData: String);
begin
Loguear(AText + ' Respuesta de ' + TIdTCPClient(IdLogEvent1.Connection).Host + ' >> ' + Adata, archLog);
TcpClient1.Disconnect;
end;
PROCEDURE ActualizaDatosPC();
begin
try
IdLogEvent1 := TIdLogEvent.Create(nil);
TcpClient1 := TIdTCPClient.Create(nil);
try
IdLogEvent1.OnReceived := TEvents.IdLogEvent1ReceivedNEW;
IdLogEvent1.Active := TRUE;
TcpClient1.Intercept := IdLogEvent1;
TcpClient1.BoundIP := '172.23.8.4'; TcpClient1.BoundPort := 0;
TcpClient1.ReadTimeout := int_TimeOut;
except
Loguear('Error al obtener el IP Local', archLog);
raise
end;
except
Loguear('Error al obtener el IP Local', archLog);
raise;
end;
end;