[Switch] C # multicast knowledge

Source: Internet
Author: User

One disadvantage of broadcast is that it affects all computers in the subnet, even if they are not interested in this broadcast message. Multicast can solve this problem.

 

Multicast adopts Promotion Technology(Browsing Web pages is a drawing technology, and also a pushing technology.EmailService). Multicast is also called multicast. If a user joins a multicast group, it can receive data sent to the group.

 

Multicast ApplicationDClassIPAddress (224.0.0.0-239.255.255.255), But it does not mean that the computer that receives data from each multicast group must haveDClassIPAddress. Multicast Group needsDClassIPAddress.DClassIPAddress is divided into several disconnections, some of which have special purposes.

 

Multicast has two application modes. One is that any user in a group sends messages, and other users can receive messages. The status of each user is equivalent. The other is that only one user sends information, and the other users only receive information.

 

The topology of multicast is a tree structure.

 

Hardware that must support multicast and MulticastTCP/IPProtocol stack, supporting multicast software. To join a multicast group, you must useSgmp(Simple Group Management Protocol) Protocol. Another message is sent to multicast.TTL (time to live)Value so that the multicast information does not pass through many subnet boundaries. The default value isTTLThe value is1That is, it is only valid for the local subnet.

 

C #Support for Multicast

Multicast programming needsUDP,Two classes support multicast network programming.Socket,AndUdpclient.A computer must join a group to receive information sent to a group.SocketClass to callSetsocketoptionAdd and remove functions from a group.UdpclientClass can be called by directly adding or leaving a group of member functions. To send a message to a group, there is nothing special. You only need to set the destination address of the sent data as the multicast address.

 

Problem:

Q:UDP ServerJoin a multicast group, bind a port, and start to receive data. what data can be received?

A: You can receive data sent to this multicast group port, broadcast data sent to this port, and unicast data sent to this port.

 

Q :(1) How to know the situation of multicast groups around you (DClassIPAddress occupied )? (2) Can I create a multicast group just by programming? (No information found)

A :(1. (2). Yes,SocketSend data to the port of a fixed multicast address, then a multicast group is established, and other computers can join the Group marked by this address to receive information.(Of course, hardware and software protocols are required. In addition, the value of this multicast address is also limited, and the multicast address is similar192.168.0.0The IP address that is used only for the LAN and is not routed.)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.