Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Netzwerke (https://www.delphipraxis.net/14-netzwerke/)
-   -   Delphi IDtelnet problem (https://www.delphipraxis.net/15576-idtelnet-problem.html)

the_seed 31. Jan 2004 15:49


IDtelnet problem
 
HI, da ich keine ahnung habe von der telnet kompo habe ich die demo genommen und wollte sie umschreiben nur mein problem ist wenn ich mich via telnet verbinde soll normaler benutzername ... kommen aber das eingabe feld wird nach eingabe entweder doppelt od. buchstabe und * angezeigt ich komme irgendeir nicht klar damit, vielleicht kann mir hier jemand helfen.

Delphi-Quellcode:
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.

the_seed 16. Mai 2004 17:47

Re: IDtelnet problem
 
hallo? kann mir niemand helfen?

Codehunter 1. Jul 2008 10:12

Re: IDtelnet problem
 
Ich weiß die Antwort kommt ein paar Tage zu spät, aber vielleicht hilfts ja noch irgendwem: Bei TIdTelnetServer beinhalten diverse Events den Connection-Thread. Wann immer man AThread.Connection.InputLn aufruft, muss man einfacherweise einen zweiten Parameter mitgeben:

AThread.Connection.InputLn('*', FALSE);

bewirkt, daß das zuletzt übertragene Zeichen nicht mehr als Echo zurück kommt.


Alle Zeitangaben in WEZ +1. Es ist jetzt 12:07 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz