Package 

Class SinglePortUdpHarvester

  • All Implemented Interfaces:
    org.ice4j.ice.harvest.CandidateHarvester

    
    public class SinglePortUdpHarvester
    extends AbstractUdpListener implements CandidateHarvester
                        

    A harvester implementation which binds to a single DatagramSocket and provides local candidates of type "host". It runs a thread (thread) which perpetually reads from the socket. When harvest is called, this harvester creates and adds to the component a org.ice4j.ice.harvest.SinglePortUdpHarvester.MyCandidate instance, and associates the component's local username fragment (ufrag) with this candidate. When a STUN Binding Request with a given ufrag is received, if the ufrag matches one of the registered candidates, then a new socket is created, which is to receive further packets from the remote address, and the socket is added to the candidate.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
      SinglePortUdpHarvester(TransportAddress localAddress) Initializes a new SinglePortUdpHarvester instance which is to bind on the specified local address.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      HarvestStatistics getHarvestStatistics() Returns the statistics describing how well the various harvests of this harvester went.
      static List<SinglePortUdpHarvester> createHarvesters(int port) Creates a new SinglePortUdpHarvester instance for each allowed IP address found on each allowed network interface, with the given port.
      Collection<LocalCandidate> harvest(Component component) Gathers all candidate addresses of the type that this CandidateHarvester supports.
      boolean isHostHarvester() Returns true if this CandidateHarvester is to be considered a harvester for host candidates.
      • Methods inherited from class org.ice4j.ice.harvest.AbstractUdpListener

        close, getAllowedAddresses
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SinglePortUdpHarvester

        SinglePortUdpHarvester(TransportAddress localAddress)
        Initializes a new SinglePortUdpHarvester instance which is to bind on the specified local address.
        Parameters:
        localAddress - the address to bind to.
    • Method Detail

      • createHarvesters

         static List<SinglePortUdpHarvester> createHarvesters(int port)

        Creates a new SinglePortUdpHarvester instance for each allowed IP address found on each allowed network interface, with the given port.

        Parameters:
        port - the UDP port number to use.
      • harvest

         Collection<LocalCandidate> harvest(Component component)

        Gathers all candidate addresses of the type that this CandidateHarvester supports. The gathered candidate addresses are to be added by this CandidateHarvester to the specified Component using Component#addLocalCandidate(LocalCandidate) as soon as they are discovered.

      • isHostHarvester

         boolean isHostHarvester()

        Returns true if this CandidateHarvester is to be considered a harvester for host candidates. Such a harvester should 1. Create local candidates of type HOST_CANDIDATE. 2. Not depend on other local candidates, already harvested for the component for which it is called. 3. Not perform blocking operations while harvesting.