TsgcTURNServer › 方法 › RemoveBinding
移除之前添加的监听端点并关闭其套接字,而不停止 TURN 服务器。
function RemoveBinding(const aIPAddress: string; aPort: Integer): Boolean;
| 名称 | 类型 | 描述 |
|---|---|---|
aIPAddress | const string | 要删除的绑定的本地 IP 地址。必须与之前传递给 AddBinding 的值(或默认绑定的 Host)匹配。 |
aPort | Integer | 要删除的绑定的本地 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');