Implementing LAN IP Multicast with Visual C + +

Source: Internet
Author: User
Tags join reserved

In a local area network, administrators often need to send a piece of information to a group of users. If the use of a one-to-one delivery method, although it is feasible, but too troublesome, there are often leakage, wrong hair. In order to solve this group communication problem more effectively, a kind of multicast technology (also commonly called multicast communication) is presented, which is based on IP layer communication technology. To help readers understand, the following is a brief introduction to the concept of multicast.

As we all know, ordinary IP communication is between a sender and a receiver, we often call it point-to-point communication, but for some applications, this point-to-point communication mode can not effectively meet the needs of practical applications. For example: A digital teleconferencing system consists of a number of venues, when the participants in one of the venues to speak, ask other venues to be able to get the content of this speech, this is a typical one-to-many communication applications, usually this one-to-many communication is called multicast traffic. Using multicast communication technology, not only can realize the function of communication between a sender and multiple receivers, but also can effectively reduce the burden of network communication and avoid unnecessary waste of resources.

Broadcasting is also a mode of realizing one-to-many data communication, but broadcast and multicast are different in the way of implementation. Broadcasting is the issue of data from a workstation, all other workstations within the LAN can receive it. This feature applies to connectionless protocols because all machines on a LAN can obtain and process broadcast messages. The disadvantage of using broadcast messages is that each machine must process the message. Multicast traffic is different, when data is sent from one workstation, and if processes running on other LANs represent "interested" in the data, multicast data is made available to them.

This example consists of sender and receiver two programs, sender users from the console input multicast data, receiver end are required to join the same multicast group, to complete the receive sender sent multicast data.

One, the realization method

1. Agreement Support

Not all protocols support multicast traffic, and for the Win32 platform, only two protocols (IP/ATM) that can be accessed from within Winsock provide support for multicast traffic. Because the usual communication applications are based on the TCP/IP protocol, this paper discusses the multicast communication technology only for IP protocol.

Platforms that support multicast traffic include Windows CE 2.1, Windows 95, Windows 98, Windows NT 4, Windows 2000, and XP. Since version 2.1, Windows CE has been implementing support for IP multicasting. This example is based on the Windows XP Professional platform.

2. Multicast address

IP uses class D addresses to support multicast. Each class D address represents a set of hosts. There are 28 bits available to identify the team. So there can be as many as 2.5 billion groups at the same time. When a process sends a group to a Class D address, it will do its best to send it to all members of the team, but it is not guaranteed to be delivered to all. Some members may not be able to receive this grouping. For example, assuming that all five nodes want to communicate with each other through I p multicast, they can join the same group address. After all this is added, any data sent by a single node is copied exactly the same, to each member within the group, even to the node that originated the data. Class D I p address range between 244.0.0.0 to 239.255.255.255. It is divided into two categories: permanent address and temporary address. Permanent addresses are reserved for special purposes. For example, 244.0.0.0 is not used at all (and cannot be used), 244.0.0.1 represents all the systems (hosts) in the subnet, and 244.0.0.2 represents all the routers within the subnet. In the RFC 1700 file, a detailed list of all reserved addresses is provided. This file is a list of all the resources reserved for special purposes and can be used for reference. The Internet allocation Digital Expert Group (I a N a) is responsible for maintaining this list. In table 1, we summarize some of the addresses currently labeled "Reserved". A temporary group address must be created before it can be used, and a process may require its host to join a particular group, and it can also request its host to detach from the group. When the last process on the host is detached from a group, the group address is no longer present in this host. Each host has to record which group its processes currently belong to. Table 1 Description of part of permanent address

Address description

244.0.0.1 Basic Address (reservation)

All systems on 244.0.0.1 subnet

All routers on the 244.0.0.2 subnet

244.0.0.5 all OSPF routers on the subnet

244.0.0.6 all designated OSPF routers on the subnet

244.0.0.9 RIP 2nd version Group address

244.0.1.1 Network Time Protocol

244.0.1.24 WINS server group address

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.