The Indy UDP server component seems to depend on Windows messages, as I see new messages appear only when the mouse cursor moves over the form which contains the server component.
I created the component at run time using this code:
private
{ Private declarations }
Srv: TIdUDPServer;
...
procedure TForm1.FormCreate(Sender: TObject);
begin
Srv := TIdUDPServer.Create(Self);
Srv.DefaultPort := 9009;
Srv.OnUDPRead := Self.udpServerUDPRead;
Srv.Active := True;
end;
I would prefer a console or service application. Do I need an (invisible) window handle + some windows message queue code which to get this component working?
Update: some (inofficial) documentation says:
TIdUDPServer when active creates a listening thread to listen for inbound UDP packets. ... When ThreadedEvent is false, the OnUDPRead event will be fired in the context of the main program thread. When ThreadedEvent is true, the OnUDPRead event is fired in the context of the listener thread.