Code example for MulticastSocket

Methods: joinGroup

0
    private String nick;
 
    public SocketData(String host, int port, String nick) throws IOException {
        this.port = port;
        this.host = host;
        this.socket = new MulticastSocket(port);
        this.inetAddress = InetAddress.getByName(host);
        this.socket.joinGroup(inetAddress);
        this.nick = nick;
    } 
 
    public MulticastSocket getSocket() {
        return socket;
    } 
 
    public InetAddress getInetAddress() {
        return inetAddress;
    } 
 
    public int getPort() { 
        return port;