unit telnetsrvmain;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, IdBaseComponent, IdComponent, IdTCPServer, IdTelnetServer,
IdAntiFreezeBase, IdAntiFreeze;
type
TMainForm =
class(TForm)
IdTelnetServer1: TIdTelnetServer;
IdAntiFreeze1: TIdAntiFreeze;
buttonExit: TButton;
Label1: TLabel;
procedure IdTelnetServer1Authentication(AThread: TIdPeerThread;
const AUsername, Apassword:
String;
var AAuthenticated: Boolean);
procedure IdTelnetServer1Execute(AThread: TIdPeerThread);
procedure buttonExitClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
MainForm: TMainForm;
implementation
{$R *.DFM}
procedure TMainForm.IdTelnetServer1Authentication(AThread: TIdPeerThread;
const AUsername, APassword:
String;
var AAuthenticated: Boolean);
label o,k;
begin
AAuthenticated:=false;
if AUsername='
felix'
then begin goto o;
end
else
AThread.Connection.WriteLn('
Anmeldung nicht korrekt.');
AThread.Connection.disconnect;
goto k;
o:
AThread.Connection.WriteLn('
Anmeldung korrekt.');
AThread.Connection.WriteLn('
');
k:
end;
procedure TMainForm.IdTelnetServer1Execute(AThread: TIdPeerThread);
var
str :
string;
begin
with AThread.Connection
do
begin
str:=readLn('
');
writeln('
');
if (str='
exit')
or (str='
logout')
then
Disconnect;
end;
end;
procedure TMainForm.buttonExitClick(Sender: TObject);
begin
if IdTelnetServer1.Active=true
then
begin
IdTelnetServer1.Active:=true
end;
Application.Terminate;
end;
end.