TsgcTURNServer方法 › RemoveBinding

RemoveBinding 方法

移除之前添加的监听端点并关闭其套接字,而不停止 TURN 服务器。

语法

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

参数

名称类型描述
aIPAddressconst string要删除的绑定的本地 IP 地址。必须与之前传递给 AddBinding 的值(或默认绑定的 Host)匹配。
aPortInteger要删除的绑定的本地 UDP 端口。

返回值

当找到匹配的端点并成功删除时返回 True;当指定的 IP/端口不存在绑定时返回 False。(Boolean

备注

RemoveBinding 是 AddBinding 的运行时对应方法:它停止附加到匹配端点的监听器,关闭其 UDP 套接字,并从内部 Bindings 集合中移除该条目,同时其余端点继续不受影响地服务 TURN 请求。通过已删除端点连接的客户端所拥有的现有分配将在其中继套接字上存活,直到它们到期或客户端使用 lifetime = 0 发出 REFRESH;仅有该 IP/端口上新请求的监听器被拆除。当没有条目与提供的 IP/端口匹配时,服务器保持不变,方法返回 False。

示例

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

返回方法