Simple multicast
MulticastSocket for multicast server and client
This week we will implement a simple multicast server and client. If you are unfamiliar with
mbone or multicast, start by browsing the
Linux Multicast FAQ by Andrew Daviel. Also,
Sun's API doc for the class
java.net.MulticastSocket
contains important information.
|
You will start by making an indeed small multicast server that just joins a group, listens to it and prints received
messages to the screen. If you take a look at the Java doc, this should almost be a matter of copy and paste.
Hint:
java.net.MulticastSocket
MultiServer.java
|
|
Now make a small multicast client that connects to the same IP and port, and sends a "Hello World" message. If you first
start your server and then run the client, you should see the message appear on the server side.
MultiClient.java
|
|
Finally, you could enhance the utilities to become a small chat system where the messages are sent by multicast packets.
However, be aware that multicast in not enabled in the networks of all commercial operators.
|
|
|