What are ICE Candidates and how do the peer connection choose between them?

前端 未结 3 649
悲哀的现实
悲哀的现实 2020-12-04 08:28

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

When the peer create a connection they get ICE Candidates

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-04 09:03

    ICE stands for Interactive Connectivity Establishment , its a techniques used in NAT( network address translator ) for establishing communication for VOIP, peer-peer, instant-messaging, and other kind of interactive media.

    Typically ice candidate provides the information about the ipaddress and port from where the data is going to be exchanged.

    It's format is something like follows

    a=candidate:1 1 UDP 2130706431 192.168.1.102 1816 typ host

    here UDP specifies the protocol to be used, the typ host specifies which type of ice candidates it is, host means the candidates is generated within the firewall. If you use wireshark to monitor the traffic then you can see the ports that are used for data transfer are same as the one present in ice-candidates.

    Another type is relay , which denotes this candidates can be used when communication is to be done outside the firewall.

    It may contain more information depending on browser you are using. Many time i have seen 8-12 ice-candidates are generated by browser.

提交回复
热议问题