private boolean gatherCandidate ( IceComponent component , InetAddress address , int startingPort , RtpPortManager portManager , Selector selector ) { // Recursion stop criteria if ( startingPort == portManager . peek ( ) ) { return false ; } // Gather the candidate using current port try { int port = portManager . current ( ) ; DatagramChannel channel = openUdpChannel ( address , port , selector ) ; HostCandidate candidate = new HostCandidate ( component , address , port ) ; this . foundations . assignFoundation ( candidate ) ; component . addLocalCandidate ( new LocalCandidateWrapper ( candidate , channel ) ) ; return true ; } catch ( IOException e ) { // The port is occupied. Try again with next logical port. portManager . next ( ) ; return gatherCandidate ( component , address , startingPort , portManager , selector ) ; } }
Gathers a candidate and registers it in the respective ICE Component . A datagram channel will be bound to the local candidate address .