Adds getSocket() to Candidate instead of having it just in HostCandidate.
This commit is contained in:
parent
67ead68836
commit
4e165d5f4e
@ -24,8 +24,9 @@ import org.ice4j.*;
|
|||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Emil Ivov
|
* @author Emil Ivov
|
||||||
|
* @author Lubomir Marinov
|
||||||
*/
|
*/
|
||||||
public class Candidate
|
public abstract class Candidate
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The transport address represented by this candidate.
|
* The transport address represented by this candidate.
|
||||||
@ -140,6 +141,14 @@ public class Candidate
|
|||||||
this.candidateType = type;
|
this.candidateType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the <tt>DatagramSocket</tt> associated with this <tt>Candidate</tt>.
|
||||||
|
*
|
||||||
|
* @return the <tt>DatagramSocket</tt> associated with this
|
||||||
|
* <tt>Candidate</tt>
|
||||||
|
*/
|
||||||
|
public abstract DatagramSocket getSocket();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the type of this candidate which should be an instance of the
|
* Returns the type of this candidate which should be an instance of the
|
||||||
* {@link CandidateType} enumeration.
|
* {@link CandidateType} enumeration.
|
||||||
|
|||||||
@ -32,7 +32,7 @@ public class HostCandidate extends Candidate
|
|||||||
* If this is a local candidate the field contains the socket that is
|
* If this is a local candidate the field contains the socket that is
|
||||||
* actually associated with the candidate.
|
* actually associated with the candidate.
|
||||||
*/
|
*/
|
||||||
private DatagramSocket socket = null;
|
private final DatagramSocket socket;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a HostCandidate for the specified transport address.
|
* Creates a HostCandidate for the specified transport address.
|
||||||
@ -55,9 +55,11 @@ public class HostCandidate extends Candidate
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the <tt>DatagramSocket</tt> associated with this candidate.
|
* Gets the <tt>DatagramSocket</tt> associated with this <tt>Candidate</tt>.
|
||||||
*
|
*
|
||||||
* @return the <tt>DatagramSocket</tt> associated with this candidate.
|
* @return the <tt>DatagramSocket</tt> associated with this
|
||||||
|
* <tt>Candidate</tt>
|
||||||
|
* @see Candidate#getSocket()
|
||||||
*/
|
*/
|
||||||
public DatagramSocket getSocket()
|
public DatagramSocket getSocket()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,16 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
|
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
||||||
|
*
|
||||||
|
* Distributable under LGPL license.
|
||||||
|
* See terms of license at gnu.org.
|
||||||
|
*/
|
||||||
package org.ice4j.ice;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
|
import java.net.*;
|
||||||
|
|
||||||
import org.ice4j.*;
|
import org.ice4j.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <tt>ServerReflexiveCandidate</tt>s are candidates whose IP address and port
|
* <tt>ServerReflexiveCandidate</tt>s are candidates whose IP address and port
|
||||||
* are a binding allocated by a NAT for an agent when it sent a packet through
|
* are a binding allocated by a NAT for an agent when it sent a packet through
|
||||||
* the NAT to a server. <tt>ServerReflexiveCandidate</tt>s can be learned by
|
* the NAT to a server. <tt>ServerReflexiveCandidate</tt>s can be learned by
|
||||||
* STUN servers using the Binding Request, or TURN servers, which provides
|
* STUN servers using the Binding Request, or TURN servers, which provides both
|
||||||
* both a Relayed and Server Reflexive candidate.
|
* a Relayed and Server Reflexive candidate.
|
||||||
* <p>
|
* <p>
|
||||||
* This class does not contain a socket itself and in order to send bytes
|
* This class does not contain a socket itself and in order to send bytes over
|
||||||
* over the network, one has to retrieve the socket of its basis.
|
* the network, one has to retrieve the socket of its base.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Emil Ivov
|
* @author Emil Ivov
|
||||||
@ -40,4 +49,16 @@ public class ServerReflexiveCandidate extends Candidate
|
|||||||
setBase(base);
|
setBase(base);
|
||||||
setStunServerAddress(stunSrvrAddr);
|
setStunServerAddress(stunSrvrAddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the <tt>DatagramSocket</tt> associated with this <tt>Candidate</tt>.
|
||||||
|
*
|
||||||
|
* @return the <tt>DatagramSocket</tt> associated with this
|
||||||
|
* <tt>Candidate</tt>
|
||||||
|
* @see Candidate#getSocket()
|
||||||
|
*/
|
||||||
|
public DatagramSocket getSocket()
|
||||||
|
{
|
||||||
|
return getBase().getSocket();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user