|
program serveradtosserver;
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
uses
|
|
cthreads, Classes, SysUtils, CustApp, demonio, clhallardatos, globales, clservidor,
|
|
IdCmdTCPServer, IdCommandHandlers,IdContext, clcomandosroot
|
|
{ you can add units after this };
|
|
|
|
type
|
|
|
|
{ TMyApplication }
|
|
|
|
TMyApplication = class(TCustomApplication)
|
|
protected
|
|
procedure DoRun; override;
|
|
public
|
|
constructor Create(TheOwner: TComponent); override;
|
|
destructor Destroy; override;
|
|
procedure WriteHelp; virtual;
|
|
end;
|
|
|
|
{ TMyApplication }
|
|
|
|
procedure TMyApplication.DoRun;
|
|
var
|
|
ErrorMsg: String;
|
|
begin
|
|
ErrorMsg:=CheckOptions('h','help');
|
|
if ErrorMsg<>'' then begin
|
|
ShowException(Exception.Create(ErrorMsg));
|
|
Terminate;
|
|
Exit;
|
|
end;
|
|
if HasOption('h','help') then begin
|
|
WriteHelp;
|
|
Terminate;
|
|
Exit;
|
|
end;
|
|
if (g_equipo_actualizado and (g_contador>1000)) then
|
|
begin
|
|
g_equipo_actualizado:=false;
|
|
g_contador:=0;
|
|
actualizaDatosEquipos();
|
|
//writeln('Actualizando esquipos');
|
|
end;
|
|
inc(g_contador);
|
|
sleep(50);
|
|
end;
|
|
|
|
constructor TMyApplication.Create(TheOwner: TComponent);
|
|
begin
|
|
inherited Create(TheOwner);
|
|
StopOnException:=True;
|
|
end;
|
|
|
|
destructor TMyApplication.Destroy;
|
|
begin
|
|
inherited Destroy;
|
|
end;
|
|
|
|
procedure TMyApplication.WriteHelp;
|
|
begin
|
|
{ add your help code here }
|
|
writeln('Usage: ',ExeName,' -h');
|
|
end;
|
|
|
|
var
|
|
Application: TMyApplication;
|
|
|
|
{$R *.res}
|
|
|
|
begin
|
|
Application:=TMyApplication.Create(nil);
|
|
Application.Run;
|
|
Application.Free;
|
|
end.
|
|
|