200 likes | 351 Vues
Multicast networking. Multicast Broadcast Class MulticastSocket Using multicast A peer-to-peer multicast chat system A client/server multicast chat system Wrapping up Conclusion. Multicast networking. Multicast and broadcast are datagram network protocols.
E N D
Multicast networking • Multicast • Broadcast • Class MulticastSocket • Using multicast • A peer-to-peer multicast chat system • A client/server multicast chat system • Wrapping up • Conclusion
Multicast networking • Multicast and broadcast are datagram network protocols. • Broadcast packets can not get across a router, while multicast packets can. • Multicast, thus, requires a router to be multicast aware: both the hosts and routers must support IGMP.
Multicast networking • Internet Group Management Protocol (IGMP) • Hosts willing to receive multicast messages (packets) need to inform their immediately-neighboring routers that they are interested in receiving multicast messages sent to certain multicast groups. • This way, each node can become a member of one or more multicast groups and receive the multicast packets sent to those groups. • The protocol through which hosts communicate this information with their local routers is called Internet Group Management Protocol (IGMP).
Multicast • A packet is sent to a multicast group. • All the interested recipients in the group will receive the packet. • As with UDP, multicast is packet-based and does not guarantee reliability. • Successful delivery may be different for different recipients in packet lost, duplication, and order.
Multicast groups • A multicast group is simply an IP address that falls into IP class D (224.0.0.0~239.255.255.255). • Recipients express an interest in receiving packets addressed to a particular multicast group. • The underlying network protocols announcing this interest to relevant routers on the network.
Multicast groups • To multicast is to simply insert a packet into the network with the appropriate target address. • A sender need not even be a member of the group. • The packet will also be picked up by routers that will forward it as appropriate to adjacent networks that are interested.
Multicast groups • The significant complexity of multicast is how routers will know what adjacent networks are interested.
The MBone • The largest deployment of multicast on the Internet is perhaps the Mbone. • A multicast packet is transported as usual within a island, but is also picked up by router hosts that transmit the data through TCP tunnels to other router hosts on other islands.
TTL-Time To Live • Multicast packets use a TTL field to limit how far a packet will propagated. • The definition of the TTL field depends on the routing protocol.
Reliability • There are other reliable multicast protocols such as MTP, RAMP, RMP, RMTP, RTP, TMTP, or XTP.
Broadcast • Similar at a local level to multicast: every broadcast-based network has a broadcast address. • Clients must choose a UDP port number on which to operate.
Multicast vs. broadcast • Multicast is preferable. • Multicast is often supported correctly, but broadcast results in a permission error. • Multicast and broadcast result in almost the same traffic. • From java, only a single client can listen to broadcast to a particular port on a single machine, while many clients can engage in the same multicast conversation from a single machine.
Class MulticastSocket • The MulticastSocket class extents the DatagramSocket class by adding support for IP multicast. • The additional methods are: • Methods to control group membership. • A send() method that allows the TTL of a multicast packet to be specified. • Java does not support querying the destination address of a received packet, so it is up to every application to manually determine whether or not any received packet is addressed to itself.
Security • Applets are restricted to receiving multicast packets from a single host, from which they came from. • They are usually not allowed to transmit multicast packets. IGMP must be used
Using multicast • Using multicast is similar to using UDP except that a TTL can be specified when a packet is sent through a MulticastSocket.
Using multicast • Receiving a multicast packet involves one more step. • The receiver must join a multicast group before waiting for packets to arrive. • An code fragment.
A peer-to-peer multicast chat system • Multicast and broadcast allow the development of true peer-to-peer applications - there is no central server. • This example shows how clients in a multicast-based chat system communicate among each other.
A client/server multicast chat system • This implementation combines unicast and multicast to overcome the Java applet security limitation. • Each client unicasts its message to a central server, which then multicast it back to all the client. • This requires that the server must reside at the Web server’s location to comply with Java applet security limitation.
A client/server multicast chat system • This system consists of two classes –MixedcastChatand MixedcastServer.
A client/server multicast chat system • To deployed as a web-based chat system, the server must run on the same machine as the web server. • Client can only connect if they are multicast-connected to the server.