TsgcTURNClient › Methods › Allocate
Sends an ALLOCATE request to the TURN server to reserve a relayed transport address.
procedure Allocate;
Sends an ALLOCATE request (RFC 5766 section 6) asking the TURN server to reserve a relayed transport address that peers can use to reach this client. The request honours TURNOptions.Allocation.Lifetime, the authentication block and the requested address family derived from IPVersion.
On success the server returns the relayed IP and port, which are reported in the OnTURNAllocate event and cached in the Allocation property. On failure (typically 401 Unauthorized followed by a signed retry, or 437 Allocation Mismatch) the OnSTUNResponseError event fires.
oTURN := TsgcTURNClient.Create(nil);
oTURN.Host := 'turn.sgcwebsockets.com';
oTURN.Port := 3478;
oTURN.TURNOptions.Authentication.Username := 'user';
oTURN.TURNOptions.Authentication.Password := 'secret';
oTURN.Allocate;