Java datagram programming Multicast

Source: Internet
Author: User
Tags reserved

In the information age, network technology has been widely used. Many applications depend on the ability to send the same information from one host to multiple hosts or from multiple hosts to multiple hosts. The number of applications distributed on the Internet can reach 100,000, these require higher bandwidth and greatly exceed the unicast capability. IP multicast is an important technology that can maximize the use of existing bandwidth.
1. Concepts of IP multicast technology
IP multicast technology is a TCP/IP network technology that allows one or more hosts (multicast sources) to send a single packet to multiple hosts (one time, at the same time, it is a one-to-multiple-point communication. In the application of network multimedia broadcast, when the signal of a node needs to be transmitted to multiple nodes, whether it is through repeated point-to-point communication or broadcast, network bandwidth is a serious waste. Only multicast is the best choice. Multicast enables one or more multicast sources to only send data packets to a specific multicast group. Only the host that joins the multicast group can receive data packets.
2. IP multicast address
IP multicast communication relies on IP multicast addresses. In IPv4, it is a Class d ip address ranging from 224.0.0.0 to 239.255.255.255, it is divided into three types: local link multicast address, reserved multicast address, and management permission multicast address. The local link multicast address ranges from 224.0.0.0 ~ 224.0.0.255 is the address reserved for the routing protocol and other purposes. The router does not forward IP packets in this range. The reserved multicast address is 224.0.1.0 ~ 238.255.255.255, which can be used for global (such as Internet) or network protocols. The management permission multicast address is 239.0.0.0 ~ 239.00000000255, which can be used within an organization. It is similar to a private IP address and cannot be used on the Internet. It can restrict the multicast range.
3. Multicast group
All hosts that use the same IP multicast address to receive multicast packets constitute a host group, also known as multicast groups. Members of a multicast group change at any time. A host can join or leave a multicast group at any time. The number and geographic location of multicast group members are not limited, A host can also belong to several multicast groups. In addition, a host that does not belong to a multicast group can also send packets to the multicast group.
This article uses the instance of the MulticastSocket class to write multicast applications. The MulticastSocket class provides operations such as connection and exit multicast.
MultiSender class list
Package recmail. multiservice;
Import java.net .*;
Import java. io. IOException;
/**
* This class encapsulates the MulticastSocket class and completes the creation and initialization of the MulticastSocket class instance,
* Provides an interface for sending data.
*/
Public class MultiSender {
Public static final int MultiSender_Port = 4099;
Private MulticastSocket road;
Private InetAddress ia;
Public MultiSender (){
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.