unit Unit1;
interface
uses
Winapi.Windows,
Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs, IdContext, IdBaseComponent, IdComponent,
IdCustomTCPServer, IdTCPServer, IdCmdTCPServer, IdHTTPProxyServer,
IdTCPConnection, IdTCPClient,
Vcl.StdCtrls, IdMappedPortTCP;
type
TForm1 =
class(TForm)
IdHTTPProxyServer1: TIdHTTPProxyServer;
Memo1: TMemo;
IdMappedPortTCP1: TIdMappedPortTCP;
procedure IdHTTPProxyServer1BeforeCommandHandler(ASender: TIdCmdTCPServer;
var AData:
string; AContext: TIdContext);
procedure IdHTTPProxyServer1Connect(AContext: TIdContext);
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure IdMappedPortTCP1OutboundConnect(AContext: TIdContext);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
PeerIP, OtherIP :
String;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
//if IdHTTPProxyServer1.Active then
//IdHTTPProxyServer1.Active := False
//else
//IdHTTPProxyServer1.Active := True;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if IdMappedPortTCP1.Active
then
IdMappedPortTCP1.Active := False
else
IDMappedPortTCP1.Active := True;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
IdHTTPProxyServer1.Active := True;
end;
procedure TForm1.IdHTTPProxyServer1BeforeCommandHandler(
ASender: TIdCmdTCPServer;
var AData:
string; AContext: TIdContext);
begin
Memo1.Lines.Add(PeerIP + '
' + AData);
end;
procedure TForm1.IdHTTPProxyServer1Connect(AContext: TIdContext);
begin
PeerIP := AContext.Connection.Socket.Binding.PeerIP;
end;
procedure TForm1.IdMappedPortTCP1OutboundConnect(AContext: TIdContext);
begin
PeerIP := AContext.Connection.Socket.Binding.PeerIP;
end;
end.