Re: Sample Code for IdTelnet

Giganews Newsgroups
Subject: Re: Sample Code for IdTelnet
Posted by:  Remy Lebeau (Indy Team) (no.spam@no.spam.com)
Date: Fri, 18 Aug 2006

"Joel" <noo…@nowhere.com> wrote in message
news:371EF6667E04E340noo…@nowhere.com...

> Does anyone have any sample code for connecting and
> issuing a command via Tidtelnet?

Have you tried using its SendCh() method yet?

    procedure SendCommand(ATelnet: TIdTelnet; const ACmd: String);
    var
        I: Integer;
    begin
        for I := 1 to Length(ACmd);
            ATelnet.SendCh(ACmd[I]);
    end;

    IdTelnet1.Connect();
    try
        SendCommand(IdTelnet1, 'HELLO');
        SendCommand(IdTelnet1, 'DOIT');
        SendCommand(IdTelnet1, 'NOW');
        SendCommand(IdTelnet1, 'BYE');
    finally
        IdTelnet1.Disconnect;
    end;

Gambit

Replies

In response to

Sample Code for IdTelnet posted by Joel on Fri, 18 Aug 2006