program Neon;
uses
Forms, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdTCPServer,
Classes, Controls;
{$R *.res}
Type
THelper =
class
public
class procedure ServerExec(AThread: TIdPeerThread);
end;
class procedure THelper.ServerExec(AThread: TIdPeerThread);
var
Command:
String;
begin
//Der Server wurde aufgerufen
while AThread.Connection.Connected
do begin
//Command einlesen
Command := AThread.Connection.CurrentReadBuffer;
end;
end;
var
TcpClient: TIdTcpClient;
TcpServer: TIdTcpServer;
Buffer:
String;
begin
//StartUp, anschalten der Tcp's
TcpClient := TIdTcpClient.Create(Application.Owner);
//Client erstellen
TcpClient.Port := 18754;
//Port festlegen
TcpServer := TIdTcpServer.Create(Application.Owner);
//Server erstellen
TcpServer.DefaultPort := 18754;
//Port festlegen
TcpServer.Active := true;
//Server starten
//Events setzen
TcpServer.OnExecute := THelper.ServerExec;
//Anlaufen der DauerSchleife
while not Application.Terminated
do begin
end;
end.