TsgcSTUNClient › Methods › SendRequest
Sends a STUN Binding Request to the configured server and returns True if the request was dispatched.
function SendRequest: Boolean;
Returns True when the Binding Request was queued for sending; False if the transport could not be opened or the request could not be serialized. (Boolean)
Builds a STUN Binding Request (RFC 5389), optionally adding FINGERPRINT, SOFTWARE and MESSAGE-INTEGRITY attributes according to STUNOptions, and sends it to the endpoint defined by Host, Port, Transport and IPVersion. When UDP is used and RetransmissionOptions is enabled, the request is retransmitted until a response arrives or MaxRetries is reached. Responses are delivered through OnSTUNResponseSuccess or OnSTUNResponseError.
oSTUN := TsgcSTUNClient.Create(nil);
oSTUN.Host := 'stun.sgcwebsockets.com';
oSTUN.Port := 3478;
if oSTUN.SendRequest then
DoLog('STUN Binding Request sent');