public void bind ( boolean isLocal ) throws IOException , SocketException { try { rtpChannel = udpManager . open ( rtpHandler ) ; // if control enabled open rtcp channel as well if ( channelsManager . getIsControlEnabled ( ) ) { rtcpChannel = udpManager . open ( new RTCPHandler ( ) ) ; } } catch ( IOException e ) { throw new SocketException ( e . getMessage ( ) ) ; } // bind data channel if ( ! isLocal ) { this . rxBuffer . setInUse ( true ) ; udpManager . bind ( rtpChannel , PORT_ANY ) ; } else { this . rxBuffer . setInUse ( false ) ; udpManager . bindLocal ( rtpChannel , PORT_ANY ) ; } this . rtpChannelBound = true ; // if control enabled open rtcp channel as well if ( channelsManager . getIsControlEnabled ( ) ) { if ( ! isLocal ) udpManager . bind ( rtcpChannel , rtpChannel . socket ( ) . getLocalPort ( ) + 1 ) ; else udpManager . bindLocal ( rtcpChannel , rtpChannel . socket ( ) . getLocalPort ( ) + 1 ) ; } }
Binds channel to the first available port .