什么是 ICE Candidates 以及对等连接如何在它们之间进行选择? [英] What are ICE Candidates and how do the peer connection choose between them?

查看:19
本文介绍了什么是 ICE Candidates 以及对等连接如何在它们之间进行选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近写了一个简单的聊天应用,但我并不是很了解ICE Candidates的背景.

I newly wrote a simple chat application, but I didn't really understand the background of ICE Candidates.

当对等点创建连接时,它们会获得 ICE Candidates 并交换它们并设置他们最终到达对等连接.

When the peer create a connection they get ICE Candidates and they exchange them and set them finally to the peerconnection.

所以我的问题是,ICE 候选人来自哪里,他们是如何使用的,他们是否都真正使用过?

So my question is, where do the ICE Candidates come from and how are they used and are they all really used ?

我注意到我的同事在他的机器上执行应用程序时得到的候选人较少,可能是什么原因导致候选人数量不同?

I have noticed that my colleague got less candidates when he executes the application on his machine, what could be the reason for different amount of Candidates ?

推荐答案

@Ichigo 的答案是正确的,但它有点大.每个 ICE 都包含您网络的一个节点",直到它到达外部.通过这种方式,您将这些 ICE 发送给其他对等方,以便他们知道他们可以通过哪些连接点联系到您.把它看成一个大建筑:一个人在大楼里,需要告诉另一个(不熟悉的人)如何穿过它.在这里也是一样,如果我有很多网络设备,传入的连接需要以某种方式找到我的计算机的正确方式.通过提供所有节点,RTC 连接自己找到最短路径.因此,当您连接到您旁边的计算机时,该计算机连接到同一路由器/交换机/任何东西,它会使用所有 ICE 并确定最短的,即直接通过该点.您的同事获得较少的 ICE 候选人与它必须通过的设备数量有关.请注意,您计算机中的每个网络适配器都有一个 IP 地址(我有一个来自 hyper-v 的 vEthernet 交换机),它也会为它创建一个 ICE.

the answer from @Ichigo is correct, but it is a litte bit bigger. Every ICE contains 'a node' of your network, until it has reached the outside. By this you send these ICE's to the other peer, so they know through what connection points they can reach you. See it as a large building: one is in the building, and needs to tell the other (who is not familiar) how to walk through it. Same here, if I have a lot of network devices, the incoming connection somehow needs to find the right way to my computer. By providing all nodes, the RTC connection finds the shortest route itself. So when you would connect to the computer next to you, which is connected to the same router/switch/whatever, it uses all ICE's and determine the shortest, and that is directly through that point. That your collegue got less ICE candidates has to do with the ammount of devices it has to go through. Please note that every network adapter inside your computer which has an IP adress (I have a vEthernet switch from hyper-v) it also creates an ICE for it.

这篇关于什么是 ICE Candidates 以及对等连接如何在它们之间进行选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆