TsgcTURNServer › Methods › AddBinding
Adds an extra listening endpoint (IP/port) to the TURN server without stopping the bindings already in place.
function AddBinding(const aIPAddress: string; aPort: Integer) : TIdSocketHandle;
| Name | Type | Description |
|---|---|---|
aIPAddress | const string | Local IPv4/IPv6 address to bind to. Use an empty string, 0.0.0.0 or :: to listen on every interface. |
aPort | Integer | Local UDP port (1 to 65535) on which the TURN server accepts client requests. Use 3478 to match the IANA-reserved TURN port. |
The newly created TIdSocketHandle, or the existing one when an entry for the same IP/port is already present. The handle is owned by the internal Bindings collection and must not be freed by the caller. (TIdSocketHandle)
AddBinding adds a listening endpoint to the server while Active is True, without stopping any binding already in place. Use it to expose the TURN service on several interfaces (for example IPv4 and IPv6 on the same host) or to accept clients on an alternate port. Each additional endpoint receives the full TURN method set (ALLOCATE, REFRESH, CREATE-PERMISSION, CHANNEL-BIND, Send/Data indications and ChannelData) plus plain STUN Binding Requests. When the supplied IP/port is already bound the existing handle is returned and no additional socket is opened. The relay ports assigned to individual Allocations are not affected by this call — they are drawn from the TURNOptions.Allocation.MinPort–MaxPort range.
oTURN.AddBinding('0.0.0.0', 3478);
oTURN.AddBinding('::', 3478);
oTURN.Active := True;