Class MulticastReceiver

    • Method Detail

      • join

        public MulticastGroup join​(String groupId,
                                   int port,
                                   NetworkInterface nif,
                                   MulticastListener listener)

        Short version of join with default buffer size

        This method is equivalent to:

         
         join(groupId, port, nif, listener, MulticastReceiver.PACKET_MAXSIZE);
         
         
        Specified by:
        join in interface IMulticastReceiver
        Parameters:
        groupId - a multicast address to join
        port - port number where to receive UDP packets
        nif - The network interface on which to join the group
        listener - of the MulticastGroup events.
        Returns:
        created MulticastGroup
      • join

        public MulticastGroup join​(String groupId,
                                   int port,
                                   NetworkInterface nif,
                                   MulticastListener listener,
                                   int bufferSize)
        Creates a feed and send a join request.
        Specified by:
        join in interface IMulticastReceiver
        Parameters:
        groupId - a multicast address to join
        port - port number where to receive UDP packets
        nif - The network interface on which to join the group
        listener - listener of the MulticastGroup events.
        bufferSize - max packet size for this multicast group
        Returns:
        created MulticastGroup
      • join

        public MulticastGroup join​(InetSocketAddress group,
                                   NetworkInterface nif,
                                   MulticastListener listener,
                                   int bufferSize)
        Creates a feed and send a join request.

        This implementation creates a new handler to receive, and puts it into join queue. All such requests will be proceed in step() method

        Specified by:
        join in interface IMulticastReceiver
        Parameters:
        group - a multicast address to join with UDP port Number
        nif - The network interface on which to join the group
        listener - of the MulticastGroup events.
        bufferSize - buffer size for UDP packets of the corresponded group
        Returns:
        created MulticastGroup to receive multicast group messages
      • join

        public MulticastGroup join​(InetSocketAddress group,
                                   NetworkInterface nif,
                                   MulticastListener listener)

        Short version of join with default buffer size

        This method is equivalent to:

         
         join(group, nif, listener, MulticastReceiver.PACKET_MAXSIZE);
         
         
        Creates a feed and send a join request.
        Specified by:
        join in interface IMulticastReceiver
        Parameters:
        group - a multicast address to join with UDP port Number
        nif - The network interface on which to join the group
        listener - of the MulticastGroup events.
        Returns:
        created MulticastGroup to receive multicast group messages
      • drop

        public void drop​(MulticastGroup feed)
        Drops (and closes) attached feed. If feed doesn't belong to this Receiver, it will not be dropped.
        Specified by:
        drop in interface IMulticastReceiver
        Parameters:
        feed - feed to drop from receiving multicast
      • step

        public boolean step()
        process one step of receiving. It's: 1. Adds all feeds added by join function 2. Drops/removes feeds from drop list 3. Proceeds all opened connections
        Specified by:
        step in interface IMulticastReceiver
        Returns:
        false if MulticastReceiver cannot work farther and must be closed, true if everything going well