Indy is the standard networking library included with Delphi. It is arguably the most widely used because it is built into the IDE.
procedure TForm2.IdUDPServer1UDPRead(...); var Msg: string; begin Msg := TEncoding.UTF8.GetString(AData); TThread.Queue(nil, procedure begin Memo1.Lines.Add(Msg); end); end; delphi udp
Delphi UDP Programming: A Comprehensive Guide to High-Speed Networking Indy is the standard networking library included with Delphi
procedure SendUDP(const AHost: string; APort: Integer; const AMessage: string); var Socket: TUdpSocket; RemoteEndpoint: TEndpoint; Bytes: TBytes; begin Socket := TUdpSocket.Create; try RemoteEndpoint := TEndpoint.Create(AHost, APort); Bytes := TEncoding.UTF8.GetBytes(AMessage); Socket.SendTo(RemoteEndpoint, Bytes, 0, Length(Bytes)); finally Socket.Free; end; end; var Msg: string
For high-performance loops, it is better to reuse a single TIdUDPClient instance rather than creating and destroying it for every packet. Building a Robust UDP Server