unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdUDPBase, IdUDPServer, StdCtrls, [b]idGlobal, idSocketHandle[/b], IdUDPClient;
// in the idGlobal is das TBytes definiert
// in der idSocketHandle das TidSocketHandle
type
TForm1 =
class(TForm)
IdUDPServer1: TIdUDPServer;
Memo1: TMemo;
Edit1: TEdit;
Button1: TButton;
IdUDPClient1: TIdUDPClient;
procedure IdUDPServer1UDPRead(Sender: TObject; AData: TBytes; ABinding: TIdSocketHandle);
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.IdUDPServer1UDPRead(Sender: TObject; AData: TBytes;
ABinding: TIdSocketHandle);
var sText :
String;
begin
// dirty but working for wordfiles too ;_)
sText :=
String(AData);
Memo1.Lines.Add(sText);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
IdUDPClient1.Active := false;
IdUDPClient1.Active := true;
IdUDPClient1.Broadcast(Edit1.Text, 7080);
end;
end.