unit uMain;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdServerIOHandler, IdSSL, IdSSLOpenSSL, IdBaseComponent, IdComponent,
IdCustomTCPServer, IdTCPServer, idContext, StdCtrls;
type
TForm1 =
class(TForm)
IdTCPServer1: TIdTCPServer;
IdServerIOHandlerSSLOpenSSL1: TIdServerIOHandlerSSLOpenSSL;
Memo1: TMemo;
CheckBox1: TCheckBox;
procedure CheckBox1Click(Sender: TObject);
procedure IdTCPServer1Connect(AContext: TIdContext);
procedure IdTCPServer1Disconnect(AContext: TIdContext);
procedure IdTCPServer1Execute(AContext: TIdContext);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
IdTCPServer1.Active := Checkbox1.Checked;
end;
procedure TForm1.IdTCPServer1Connect(AContext: TIdContext);
begin
Memo1.Lines.Add('
Connect: ' + AContext.Binding.PeerIP);
end;
procedure TForm1.IdTCPServer1Disconnect(AContext: TIdContext);
begin
Memo1.Lines.Add('
Disconnect: ' + AContext.Binding.PeerIP);
end;
procedure TForm1.IdTCPServer1Execute(AContext: TIdContext);
begin
Memo1.Lines.Add('
Message: ' + AContext.Connection.IOHandler.ReadLn);
end;
end.