Code example for MulticastSocket

Methods: joinGroup, setSoTimeout

0
        public MulticastServer(SocketAddress anAddress, int aPort,
				NetworkInterface netInterface) throws java.io.IOException {
			rbuf = new byte[512];
			rbuf[0] = -1;
			rdp = new DatagramPacket(rbuf, rbuf.length);
			ms = new MulticastSocket(aPort);
			ms.setSoTimeout(2000);
            groupSockAddr = anAddress;
            groupNI = netInterface;
            ms.joinGroup(groupSockAddr, groupNI);
		} 
	} 
 
	/** 
	 * @tests java.net.MulticastSocket#MulticastSocket() 
	 */ 
	public void test_Constructor() throws IOException { 
		// regression test for 497 
        MulticastSocket s = new MulticastSocket();
        // regression test for Harmony-1162 
        assertTrue(s.getReuseAddress());