I want to develop a Web Application that sends packets to clients In JAVA using UDP protocol.
I need to send packets to each clients directly .
Java provide a class called MulticastSocket that extends UDP. This can send packets to multiple clients over the network.
But it just happens in local network not on the "Internet".
Is there any way to send multicast packet over internet ? If it possible explain it and explain how i can implement it in Java.
I found some protocols like IGMP... but I think it developed in MulticastSocket.
When sending multicast packets, if you expect them to cross one or more routers you need to set the TTL of the outgoing packet to be at least as large as the number of routers you expect to pass through. You can set this via the setTimeToLive()
method of MulticastSocket
.
IGMP messages are sent by multicast receivers to let routers know where to forward multicast traffic to. You don't need to explicitly send the packets as the OS will do it automatically when you join a multicast group via one of the joinGroup
methods.
However, the main problem with sending multicast over the public Internet is that most routers aren't configured to allow multicast traffic to pass through them. By default, they will drop IGMP packets instead of forwarding them.
There was an experimental Internet multicast backbone called the MBONE, however I don't believe it's in use anymore.
So no, you can't send multicast over the public Internet, regardless of the language.