Tuesday, July 8, 2008

Completed the CandidateGathering state

I implemented the CandidateGathering state of the IceAgent class
I introduced a separate method in IceAgent class for that
But it should only be called after MediaStreams and their associated Components are created
I provided methods for that as well

Here is a brief summary of how I implemented the CandidateGathering phase

First retrieve all the network interfaces in the host machine
using NetworkInterface.getNetworkInterfaces() method
For all of these interfaces, I check the working interfaces
I also ignore the loopback interface

For the retrieved interfaces, I collect all the IP addresses

Then for each media-stream and for each component in that media-stream
I create a Host type Candidates using all the IP addresses
Then I use the same IP addresses and use the StunClient to get the server-reflexive addresses
Then I create SERVER-REFLEXIVE type Candidates from these mapped addresses

Finally I add all the created candidate for a particular media-stream to a List

There is a single enhancement needed to be done in the implementation of this phase. For the moment I employ a different StunClient just for this task.
I'm in half way of developing a StunClient which uses a single StunStack to send both blocking and non-blocking Stun messages depending on the mode
(I completed the non-blocking part, will complete the rest quickly)

In my next post, I'll talk about the next step of my implementation

No comments: