|
{
|
|
Aulalinex 3.0-7 Software de gestión de Aulas Tecnológicas
|
|
Copyright (C) 2008-2009, Consejería de Educación,Junta de Extremadura
|
|
Programación: Manuel Narváez Martínez <mnarvaez007@gmail.com>
|
|
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 cldetectarequposalumnos;
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
interface
|
|
|
|
uses
|
|
Classes, SysUtils, IdSSLOpenSSL, IdTCPClient;
|
|
type
|
|
|
|
{ ThrDetectarEquiposAlumnos }
|
|
TDetectarEquiposEvent= procedure(procesos:String) of Object;
|
|
ThrDetectarEquiposAlumnos = class(TThread)
|
|
private
|
|
{ Private declarations }
|
|
ftexto,fhost,fcomando:string;
|
|
fcliente:TIdTcpClient;
|
|
fPuerto:integer;
|
|
fOnDetectarEquipos:TDetectarEquiposEvent;
|
|
procedure equiposDetectados;
|
|
protected
|
|
procedure Execute; override;
|
|
public
|
|
constructor Create(host,comando:string); reintroduce; overload;
|
|
property OnDetectarEquipos: TDetectarEquiposEvent read fOnDetectarEquipos write fOnDetectarEquipos;
|
|
end;
|
|
|
|
implementation
|
|
uses aulas;
|
|
constructor ThrDetectarEquiposAlumnos.Create(host,comando:string);
|
|
begin
|
|
|
|
inherited Create(true);
|
|
fPuerto:=36999;
|
|
fhost:=host;
|
|
fcomando:=comando;
|
|
FreeOnTerminate:=True;
|
|
end;
|
|
|
|
procedure ThrDetectarEquiposAlumnos.Execute;
|
|
var
|
|
size:Integer;
|
|
begin
|
|
try
|
|
// fIdSSLIOHandlerSocketOpenSSL.Destination:=':'+inttostr(37999);
|
|
fcliente:=TidTcpClient.create(nil);
|
|
try
|
|
fcliente.Host:=fhost;
|
|
fcliente.port:=fPuerto;
|
|
fcliente.connect;
|
|
fcliente.getResponse(200);
|
|
////writeln(fcomando);
|
|
fcliente.SendCmd(fcomando,305);
|
|
size:= fcliente.IOHandler.ReadLongInt(true);
|
|
ftexto:= fcliente.IOHandler.ReadString(size);
|
|
except
|
|
////writeln('Error al recoger proceso');
|
|
end;
|
|
finally
|
|
if fcliente.Connected then fcliente.Disconnect;
|
|
|
|
fcliente.free;
|
|
synchronize(@equiposDetectados);
|
|
end;
|
|
end;
|
|
procedure ThrDetectarEquiposAlumnos.equiposDetectados;
|
|
begin
|
|
if Assigned(fOnDetectarEquipos) then
|
|
begin
|
|
fOnDetectarEquipos(ftexto);
|
|
end;
|
|
end;
|
|
end.
|
|
|