UDP Client
TsgcUDPClient — low-level UDP datagram client for sgcWebSockets P2P stack; foundation for STUN, TURN and ICE.
TsgcUDPClient — low-level UDP datagram client for sgcWebSockets P2P stack; foundation for STUN, TURN and ICE.
TsgcUDPClient implements the UDP Client based on Indy library.
TsgcUDPClient| Standards & specs | UDP — RFC 768 |
| Component class | TsgcUDPClient (unit sgcUDP_Client) |
| Frameworks | VCL, FireMonkey, Lazarus / FPC |
| Platforms | Windows, macOS, Linux, iOS, Android |
The principal published / public properties used to configure and drive the component. Consult the online help for the full list.
DTLSOptions | Certificate, verification and OpenSSL settings applied when DTLS is enabled. |
Host | IP address or DNS hostname of the destination UDP peer or server. |
Port | UDP port number of the destination peer or server. |
DTLS | Enables Datagram TLS (DTLS) to encrypt the UDP traffic sent and received by this client. |
Proxy | Optional SOCKS5 proxy through which UDP datagrams are tunneled. |
LogFile | Writes every datagram sent and received to a plain-text log file for diagnostics. |
NotifyEvents | Controls how received-datagram and exception events are dispatched to the main thread. |
IPVersion | Selects the IP stack (IPv4 or IPv6) used by the UDP socket. |
Version | Read-only string with the sgcWebSockets library version that built this component. |
The principal public methods exposed by the component.
WriteData() | Sends a single UDP datagram (overloaded for text, bytes and explicit address/port). |
ClearDTLS() | Discards the cached DTLS session state so the next datagram triggers a fresh DTLS handshake. |
The component exposes the following published events; consult the online help for full event-handler signatures.
OnDTLSVerifyPeer | Fires during the DTLS handshake so the application can inspect and accept or reject the peer certificate. |
OnUDPException | Fires when the UDP reader thread catches an unhandled exception. |
OnUDPRead | Fires when an incoming UDP datagram has been received from the peer. |
Drop the component on a form, configure the properties below and activate it. The snippet that follows shows the typical TsgcUDPCLient configuration sourced from the online help.
oClient := TsgcUDPClient.Create(nil); oClient.Host := '127.0.0.1'; oClient.Port := 80;
oClient = new TsgcUDPCLient(); oClient->Host = "127.0.0.1"; oClient->Port = 80;
oClient = new TsgcUDPCLient(); oClient.Host = "127.0.0.1"; oClient.Port = 80;
The following scenarios are lifted verbatim from the online help. Each shows the configuration and method calls needed to drive the component through a specific real-world flow.
TsgcUDPServer implements the UDP Server based on Indy library.
oClient := TsgcUDPServer.Create(nil); oClient.Port := 80;
oClient = new TsgcUDPServer(); oClient->Port = 80;
oClient = new TsgcUDPServer(); oClient.Port = 80;
Every external claim links back to a primary source. The online-help references decode the canonical deep-link the company maintains for this component.
Demos\35.P2P\01.UDP_Server_Client