Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Internet (https://www.clubdelphi.com/foros/forumdisplay.php?f=3)
-   -   Problema al crear un IdTelnet (https://www.clubdelphi.com/foros/showthread.php?t=63835)

newgeek 05-03-2009 00:10:28

Problema al crear un IdTelnet
 
Que tal!! tengo un pequeño problema al intentar crear un IdTelnet en una aplicacion de consola, ahi les va el codigo...

Código Delphi [-]
procedure reboot;
var telnet:TIdTelnet;
begin
  telnet:=TIdTelnet.Create(nil);
  with telnet do
  begin
    Host:='192.168.0.1';
    Port:=23;
    Connect;
    if connected then
    begin
      telnet.OnDataAvailable(sender:TObject); // Aqui es donde me da un error
      WriteLn('admin');
      WriteLn('12345678');
      WriteLn('system');
      WriteLn('reboot');
      close;
    end;
  end;
end;

dec 04-04-2009 14:09:29

Hola,

Si hubieras puesto el error que te aparece... de todas formas, no puedes ejecutar un método tal como haces. Podrías hacer algo así:

Código Delphi [-]
telnet.OnDataAvailable(sender);

Pero, parece algo raro... creo más bien que tratas de asignar un método a un evento, algo así:

Código Delphi [-]
telnet.OnDataAvailable := MetodoAEjecutarOnDataAvailable;

¿Eso eso o me equivoco? :)


La franja horaria es GMT +2. Ahora son las 11:33:58.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi