desarrollosconsejeria/adtos-server/1.7-0/adtos/clcomandos.pas @ 29401061
54e95a47 | Elisa | {
|
|
23a384b9 | Elisa | Adtos 1.6-5 Software de gestión de Aulas Tecnológicas
|
|
Copyright (C) 2008-2009, Consejería de Educación,Junta de Extremadura
|
|||
54e95a47 | Elisa | Programación: Manuel Narváez Martínez <mnarvaez007@gmail.com>
|
|
Diseño gráfico: Ana María Zamora Moreno
|
|||
23a384b9 | Elisa | Desarrollado con Lazarus 0.9.30
|
|
54e95a47 | Elisa | ||
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 clcomandos;
|
|||
interface
|
|||
uses
|
|||
23a384b9 | Elisa | globales,Classes, IdComponent, IdSSLOpenSSL, IdTCPClient;
|
|
54e95a47 | Elisa | ||
type
|
|||
ThrComandos1 = class(TThread)
|
|||
private
|
|||
{ Private declarations }
|
|||
fcodigo:integer;
|
|||
23a384b9 | Elisa | fIdSSLIOHandlerSocketOpenSSL: TIdSSLIOHandlerSocketOpenSSL;
|
|
54e95a47 | Elisa | fhost,fcomando:string;
|
|
fcliente:TIdTcpClient;
|
|||
fpuerto:integer;
|
|||
protected
|
|||
procedure Execute; override;
|
|||
public
|
|||
constructor Create(codigo:integer;host,comando:string);
|
|||
end;
|
|||
implementation
|
|||
constructor ThrComandos1.Create(codigo:integer;host,comando:string);
|
|||
begin
|
|||
inherited Create(true);
|
|||
fcodigo:=codigo;
|
|||
fpuerto:=PUERTO_USUARIO;
|
|||
fhost:=host;
|
|||
fcomando:=comando;
|
|||
FreeOnTerminate:=True;
|
|||
end;
|
|||
procedure ThrComandos1.Execute;
|
|||
begin
|
|||
try
|
|||
23a384b9 | Elisa | fIdSSLIOHandlerSocketOpenSSL:= TIdSSLIOHandlerSocketOpenSSL.Create(nil);
|
|
fIdSSLIOHandlerSocketOpenSSL.Port:= fpuerto;
|
|||
fIdSSLIOHandlerSocketOpenSSL.SSLOptions.Mode:=sslmClient;
|
|||
fIdSSLIOHandlerSocketOpenSSL.SSLOptions.Method:=sslvSSLv3;
|
|||
fIdSSLIOHandlerSocketOpenSSL.SSLOptions.SSLVersions:=[sslvSSLv3];
|
|||
54e95a47 | Elisa | fcliente:=TidTcpClient.create(nil);
|
|
23a384b9 | Elisa | fcliente.IOHandler:=fIdSSLIOHandlerSocketOpenSSL;
|
|
54e95a47 | Elisa | fcliente.Host:=fhost;
|
|
fcliente.port:=fpuerto;
|
|||
23a384b9 | Elisa | //writeln('ThrComandos1 fcomando '+ fcomando);
|
|
54e95a47 | Elisa | fcliente.connect;
|
|
try
|
|||
23a384b9 | Elisa | ||
54e95a47 | Elisa | fcliente.GetResponse(200);
|
|
fcliente.sendCmd(fcomando,fcodigo);
|
|||
finally
|
|||
23a384b9 | Elisa | if fcliente.Connected then fcliente.Disconnect;
|
|
54e95a47 | Elisa | fcliente.free;
|
|
23a384b9 | Elisa | fIdSSLIOHandlerSocketOpenSSL.Free;
|
|
54e95a47 | Elisa | end;
|
|
except
|
|||
23a384b9 | Elisa | write('Error al ejecutar comando');
|
|
54e95a47 | Elisa | end;
|
|
end;
|
|||
end.
|