Code example for MulticastSocket

Methods: getNetworkInterface, setInterface, setNetworkInterface

0
        DatagramPacket sdp = new DatagramPacket(msg.getBytes(), msg.length(), group, groupPort);
        mss.send(sdp, (byte) 10);
        Thread.sleep(1000);
        String receivedMessage = new String(server.rdp.getData(), 0, server.rdp.getLength());
        assertEquals("Group member did not recv data", msg, receivedMessage);
        mss.close();
        server.stopServer();
    } 
 
    public void test_joinGroup_null_null() throws Exception { 
        MulticastSocket mss = new MulticastSocket(0);
        try { 
            mss.joinGroup(null, null);
            fail();
        } catch (IllegalArgumentException expected) {
        } 
        mss.close();
    } 
 
    public void test_joinGroup_non_multicast_address_IPv4() throws Exception { 
        MulticastSocket mss = new MulticastSocket(0);