TsgcTURNServerMethods › RemoveBinding

RemoveBinding Method

Removes a previously added listening endpoint and closes its socket without stopping the TURN server.

Syntax

function RemoveBinding(const aIPAddress: string; aPort: Integer): Boolean;

Parameters

NameTypeDescription
aIPAddressconst stringLocal IP address of the binding to remove. Must match the value previously passed to AddBinding (or the Host of the default binding).
aPortIntegerLocal UDP port of the binding to remove.

Return Value

True when a matching endpoint was found and removed; False when no binding with the supplied IP/port exists. (Boolean)

Remarks

RemoveBinding is the runtime counterpart of AddBinding: it stops the listener attached to the matching endpoint, closes its UDP socket and removes the entry from the internal Bindings collection while the remaining endpoints keep serving TURN requests unchanged. Existing Allocations owned by clients that were reached through the removed endpoint stay alive on their relay sockets until they expire or the client issues a REFRESH with lifetime = 0; only the listener for new requests on that IP/port is torn down. When no entry matches the supplied IP/port the server is left untouched and the method returns False.

Example

if not oTURN.RemoveBinding('0.0.0.0', 3478) then
  ShowMessage('TURN binding not found');

Back to Methods