unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdBaseComponent, IdComponent,IdSocketHandle, IdUDPBase, IdUDPServer;
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
IdUDPServer1: TIdUDPServer;
procedure Button1Click(Sender: TObject);
procedure IdUDPServer1UDPRead(Sender: TObject
AData: TStream;
ABinding: TIdSocketHandle);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
s:string;
begin
s:='aaaaa';
IdUDPServer1.SendBuffer('127.0.0.1',9999,s[1],5);
end;
procedure TForm1.IdUDPServer1UDPRead(Sender: TObject
AData: TStream;
ABinding: TIdSocketHandle);
begin
memo1.Lines.Add('aaaa');
end;
end.