-
- 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.
-
-
Field Summary
Fields Modifier and Type Field Description private HarvestStatisticsharvestStatistics
-
Constructor Summary
Constructors Constructor Description SinglePortUdpHarvester(TransportAddress localAddress)Initializes a new SinglePortUdpHarvester instance which is to bind on the specified local address.
-
Method Summary
Modifier and Type Method Description HarvestStatisticsgetHarvestStatistics()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. booleanisHostHarvester()Returns true if this CandidateHarvester is to be considered a harvester for host candidates. -
-
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
-
getHarvestStatistics
HarvestStatistics getHarvestStatistics()
Returns the statistics describing how well the various harvests of this harvester went.
-
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.
-
-
-
-