import java.io.*;
import java.net.*;

public class MultiDateClient {
    public static void main(String[] args) throws IOException {
        String groupIP="230.0.0.1";
        int port = 4446;
        MulticastSocket socket = new MulticastSocket(port);
        InetAddress group = InetAddress.getByName(groupIP);
        socket.joinGroup(group);
        DatagramPacket packet;
        for (int i = 0; i < 5; i++){
            byte[] buf = new byte[256];
            packet = new DatagramPacket(buf, buf.length);
            socket.receive(packet);
            buf = packet.getData();
            int len = packet.getLength();
            String received = new String(buf).substring(0,len);
            System.out.println("Todays date: " + received);
        }
    }
}
