Some understandings for UDP multicast

xiaoxiao2021-03-06  72

Some understandings for UDP multicast

Using the UDP multicast, data is broadcast on the form of the INTARNET, the Internet, which is multicast on the Internet, requires the router to support IGMP (Internet Gateway Management Agreement, this protocol is after IP, in order to support multicast And there is a broadcast relative to extreme network bandwidth (broadcast can only broadcast in intranet), UDP multicast has greatly optimized, only the terminal adds to a broadcast group, UDP multicast data He was accepted by him. The UDP multicast is a connectionless, the datagram connection method is used, so it is unreliable. That is, data can not be guaranteed by the data that the data can reach the receiving end and the data arrival. But because UDP does not guarantee Data reliability, all data transmission speed is very fast.

I. The "root" multicast of multicast is divided into two parts: the control section and the data section. The control section determines the organization of the multicast object. The data section determines the transmission mode of the data. There are two cases of "there is a root" and "no root". For the root control layer, there is a root and several Leaf. Root is responsible for managing this multicast group, only he can invite an Leaf to join a multicast group (ATM is a typical example of root control). For the root control layer, there is no root, only a number of Leaf. Every Leaf can join a multicast group (IP is a typical example of the non-rootless control) The data layer also has "root", "no root" Happening. For the root data layer, the data emitted from root can reach each Leaf, and data from Leaf can only reach root. For root data layer, each Leaf issued data can reach each of the multicast group. (And even himself). Each Leaf can also accept any packets in the multicast group.

two. IP multicast address IP multicast communication requires a special multicast address. IP multicast address is a set of D-class IP addresses, ranging from 224.0.0.0 to 239.255.255.255. There are still many addresses that are preserved for special purposes. The address of 224.0.0.0 to 224.0.0.255 is preferably not used, because most of them are maintained for special purposes (such as IGMP protocol)

three. IGMP protocol IGMP (Internet Gateway Management Protocol) is the basis for IP multicast. After the IP protocol appears, IGMP is generated in order to join the multicast support. The IGMP is actually telling the router. Someone in the subnet in this router is interested in the data sent to a multicast group, so when the data of this multicast group arrives, the router will not abandon it. But transfer him to all of your customers. If A and B in different subnets are multicast communication, all routers between bits and a, b must support IGMP protocols, otherwise communication between A and B cannot be performed. When an application is added to a multicast group, you will send an IGMP to all routers of this subnet to tell him that someone is interested in data that is sent to a multicast group. Router is also timed All terminals in the network sends a query message to ask if someone is interested in the data of a multicast group. If there is, the terminal will respond to an IGMP message, and the router continues to forward the data of this multicast group. If no one responds to this message, the router believes that there is no terminal to be interested in the data of this multicast group, and will not forward data about this multicast group. In the second edition of IGMP, after a terminal introduces a multicast group, send a message to the router, the router will also judge whether or not to continue forwarding the data of this multicast group (IGMP first edition) Without this feature) [These things are all under the underlying system, you only need to enjoy its achievements]

4. Winsock 1 multicast Winsock 1 has the following steps: 1. Establish Scoket2 supporting the datagram. Bind the socket and a local port (send and receive data by this port) 3. Add a multicast group 4 through SetsockOpt IP_ADD_MEMBERSHIP. Then, the data can be performed by Sendto / Recvfrom. Leave a multicast group 6 via SetsockOpt IP_Drop_membership. Close Socket If you just want to send data to a multicast group, don't accept data, then you can send data to multicast groups to multicast groups through Sendto groups without adding data.

5.Winsock 2 Multicast Winsock 2 Multicast is mainly implemented by WSAJoinleaf (WSAJINLEAF behavior, return value according to Socket mode, multicast implementation framework has a big relationship) Winsock 2 multicast has the following Step 1. Establish Socket supporting the datagram (to establish some attributes for WSASocket, and set up some properties of multicast) 2. Bind the socket and the local port of the local (send and receive data from this port) 3. Add to WSAJINLEAF A multicast group 4. Data transmission and reception by sendto / recvfrom 5. Turn off directly to the Socket, exit the multicast group

转载请注明原文地址:https://www.9cbs.com/read-120442.html

New Post(0)