desarrollosconsejeria/aulalinex-ltsp-server/4.2-2/serveraulalinexltsp/clcomandosroot.pas @ master
a2ba555f | Elisa | {
|
|
23a384b9 | Elisa | Aulalinex 3.3-0 Software de gestión de Aulas Tecnológicas
|
|
Copyright (C) 2008-2010, Manuel Narváez Martínez <mnarvaez007@gmail.com>
|
|||
a2ba555f | Elisa | Diseño gráfico: Ana María Zamora Moreno
|
|
Desarrollado con Lazarus 0.9.26
|
|||
This program is free software; you can redistribute it and/or modify
|
|||
it under the terms of the GNU General Public License as published by
|
|||
the Free Software Foundation; either version 2 of the License, or
|
|||
(at your option) any later version.
|
|||
This program is distributed in the hope that it will be useful,
|
|||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||
GNU General Public License for more details.
|
|||
You should have received a copy of the GNU General Public License
|
|||
along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
}
|
|||
unit clcomandosroot ;
|
|||
{$mode objfpc}{$H+}
|
|||
interface
|
|||
uses
|
|||
Classes, IdComponent, IdTCPClient;
|
|||
type
|
|||
ThrComandosRoot = class(TThread)
|
|||
private
|
|||
{ Private declarations }
|
|||
fhost:string;
|
|||
23a384b9 | Elisa | fpuerto,fcodigo:integer;
|
|
a2ba555f | Elisa | fcomando:string;
|
|
fcliente:TIdTcpClient;
|
|||
protected
|
|||
procedure Execute; override;
|
|||
public
|
|||
23a384b9 | Elisa | constructor Create(host:string;codigo,puerto:integer;comando:string);
|
|
a2ba555f | Elisa | end;
|
|
implementation
|
|||
23a384b9 | Elisa | constructor ThrComandosRoot.Create(host:string;codigo,puerto:integer;comando:string);
|
|
a2ba555f | Elisa | begin
|
|
inherited Create(true);
|
|||
23a384b9 | Elisa | fpuerto:=puerto;
|
|
a2ba555f | Elisa | fcodigo:=codigo;
|
|
fcomando:=comando;
|
|||
FreeOnTerminate:=True;
|
|||
fhost:=host;
|
|||
end;
|
|||
procedure ThrComandosRoot.Execute;
|
|||
begin
|
|||
try
|
|||
fcliente:=TidTcpClient.create(nil);
|
|||
try
|
|||
fcliente.Host:=fhost;
|
|||
fcliente.port:=fpuerto;
|
|||
fcliente.connect;
|
|||
try
|
|||
fcliente.GetResponse(200);
|
|||
fcliente.sendCmd(fcomando,fcodigo);
|
|||
finally
|
|||
fcliente.Disconnect;
|
|||
end;
|
|||
except
|
|||
//writeLn(MEN_ERROR_ENVIAR_COMANDO);
|
|||
end;
|
|||
finally
|
|||
fcliente.free;
|
|||
end;
|
|||
end;
|
|||
end.
|