unit Unit1;
interface
uses
Winapi.Windows,
Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs, IdUDPServer, IdGlobal, IdSocketHandle,
IdComponent,
Vcl.StdCtrls, IdBaseComponent, IdUDPBase;
type
TForm1 = class(TForm)
Memo1: TMemo;
IdUDPServer1: TIdUDPServer;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure IdUDPServer1Status(ASender: TObject; const AStatus: TIdStatus;
const AStatusText: string);
procedure IdUDPServer1UDPRead(AThread: TIdUDPListenerThread;
const AData: TIdBytes; ABinding: TIdSocketHandle);
procedure FormDestroy(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
IdUDPServer1.DefaultPort:=50001;
IdUDPServer1.Active:=true;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
IdUDPServer1.Active:=false;
end;
procedure TForm1.IdUDPServer1Status(ASender: TObject; const AStatus: TIdStatus;
const AStatusText: string);
begin
Memo1.Lines.Add('Status'+AStatusText);
end;
procedure TForm1.IdUDPServer1UDPRead(AThread: TIdUDPListenerThread;
const AData: TIdBytes; ABinding: TIdSocketHandle);
var
sText:String;
begin
sText := BytesToString(AData);
Memo1.Lines.Add(sText);
end;
end.