Delphi7做了一个简易的超级终端
利用TIDTelnet组件做了一个简易的超级终端。indy9 只能用 sendch。目前有个问题一直不知如何解决:利用SendCh发送用户名后,不能等到返回Password:再输入密码。 github地址??? AmosAlbert 发表于 2020-1-18 17:41github地址???
没看明白你说的是什么,这个小程序主要目的是测试idtelnet组件的用法 AmosAlbert 发表于 2020-1-18 17:41
github地址???
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdTelnet;
type
TForm1 = class(TForm)
mmo1: TMemo;
btn1: TButton;
idtlnt1: TIdTelnet;
edt1: TEdit;
lbl1: TLabel;
edtIP: TEdit;
lbl2: TLabel;
lbl3: TLabel;
edtport: TEdit;
btn2: TButton;
procedure btn1Click(Sender: TObject);
procedure idtlnt1DataAvailable(Sender: TIdTelnet;
const Buffer: String);
procedure btn2Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
i,b:Integer ;
s:string ;
implementation
{$R *.dfm}
procedure TForm1.btn1Click(Sender: TObject);
begin
s:=Trim(edt1.Text );
for i:=1 to Length(s) do
begin
idtlnt1.SendCh(s) ;
end;
idtlnt1.SendCh(#13) ;
edt1.Text := '' ;
end;
procedure TForm1.idtlnt1DataAvailable(Sender: TIdTelnet;
const Buffer: String);
begin
mmo1.Lines.Add(Buffer) ;
end;
procedure TForm1.btn2Click(Sender: TObject);
begin
idtlnt1.Host :=Trim(edtIP.Text ) ;
idtlnt1.Port := StrToInt( trim( edtport.Text ) );
if not idtlnt1.Connectedthen
idtlnt1.Connect(2000) ;
// idtlnt1.Connect(const atimeout:Integer = 2000) ;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if idtlnt1.Connected then
idtlnt1.Disconnect ;
end;
end.
又改了下 可以开源到github上面 {:10_256:}{:10_256:}{:10_256:}
页:
[1]