FileDocCategorySizeDatePackage
MulticastClient.javaAPI DocExample725Tue Dec 12 18:58:32 GMT 2000None

MulticastClient

public class MulticastClient extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)


        MulticastSocket socket = new MulticastSocket(4446);
        InetAddress address = InetAddress.getByName("230.0.0.1");
	socket.joinGroup(address);

        DatagramPacket packet;
    
            // get a few quotes
	for (int i = 0; i < 5; i++) {

	    byte[] buf = new byte[256];
            packet = new DatagramPacket(buf, buf.length);
            socket.receive(packet);

            String received = new String(packet.getData());
            System.out.println("Quote of the Moment: " + received);
	}

	socket.leaveGroup(address);
	socket.close();