public class GoogleRelayedCandidateDatagramSocket extends DatagramSocket
Modifier and Type | Field and Description |
---|---|
private boolean |
closed
The indicator which determines whether this instance has started
executing or has executed its
close() method. |
private static Logger |
logger
The Logger used by the
GoogleRelayedCandidateDatagramSocket class and its instances for
logging output.
|
private GoogleRelayedCandidate |
relayedCandidate
The GoogleRelayedCandidate which uses this instance as the value
of its socket property.
|
private GoogleRelayedCandidateDelegate |
socketDelegate
The GoogleTurnCandidateDelegage which will handle send/receive
operations.
|
private GoogleTurnCandidateHarvest |
turnCandidateHarvest
The GoogleTurnCandidateHarvest which has harvested
relayedCandidate . |
Constructor and Description |
---|
GoogleRelayedCandidateDatagramSocket(GoogleRelayedCandidate relayedCandidate,
GoogleTurnCandidateHarvest turnCandidateHarvest,
String username)
Initializes a new GoogleRelayedCandidateDatagramSocket instance
which is to be the socket of a specific
RelayedCandidate harvested by a specific
TurnCandidateHarvest.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this datagram socket.
|
InetAddress |
getLocalAddress()
Gets the local address to which the socket is bound.
|
int |
getLocalPort()
Returns the port number on the local host to which this socket is bound.
|
InetSocketAddress |
getLocalSocketAddress()
Returns the address of the endpoint this socket is bound to, or
null if it is not bound yet.
|
GoogleRelayedCandidate |
getRelayedCandidate()
Gets the RelayedCandidate which uses this instance as the value
of its socket property.
|
void |
processResponse(StunResponseEvent response)
Dispatch the specified response.
|
void |
processSuccess(Response response,
Request request)
Notifies this GoogleRelayedCandidateDatagramSocket that a
specific Request it has sent has received a STUN success
Response.
|
void |
receive(DatagramPacket p)
Receives a datagram packet from this socket.
|
void |
send(DatagramPacket p)
Sends a datagram packet from this socket.
|
bind, connect, connect, disconnect, getBroadcast, getChannel, getInetAddress, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoTimeout, getTrafficClass, isBound, isClosed, isConnected, setBroadcast, setDatagramSocketImplFactory, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSoTimeout, setTrafficClass
private static final Logger logger
private boolean closed
close()
method.private final GoogleRelayedCandidate relayedCandidate
private final GoogleTurnCandidateHarvest turnCandidateHarvest
relayedCandidate
.private final GoogleRelayedCandidateDelegate socketDelegate
public GoogleRelayedCandidateDatagramSocket(GoogleRelayedCandidate relayedCandidate, GoogleTurnCandidateHarvest turnCandidateHarvest, String username) throws SocketException
relayedCandidate
- the RelayedCandidate which is to use the
new instance as the value of its socket propertyturnCandidateHarvest
- the TurnCandidateHarvest which has
harvested relayedCandidateusername
- usernameSocketException
- if anything goes wrong while initializing the new
GoogleRelayedCandidateDatagramSocket instancepublic void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in class DatagramSocket
DatagramSocket.close()
public InetAddress getLocalAddress()
If there is a security manager, its checkConnect method is first called with the host address and -1 as its arguments to see if the operation is allowed.
getLocalAddress
in class DatagramSocket
getLocalSocketAddress()
,
DatagramSocket.getLocalAddress()
public int getLocalPort()
getLocalPort
in class DatagramSocket
getLocalSocketAddress()
,
DatagramSocket.getLocalPort()
public InetSocketAddress getLocalSocketAddress()
getLocalSocketAddress
in class DatagramSocket
DatagramSocket.getLocalSocketAddress()
public final GoogleRelayedCandidate getRelayedCandidate()
public void processSuccess(Response response, Request request)
response
- the Response which responds to requestrequest
- the Request sent by this instance to which
response respondspublic void processResponse(StunResponseEvent response)
response
- the response to dispatch.public void receive(DatagramPacket p) throws IOException
receive
in class DatagramSocket
p
- the DatagramPacket into which to place the incoming
dataIOException
- if an I/O error occursDatagramSocket.receive(DatagramPacket)
public void send(DatagramPacket p) throws IOException
send
in class DatagramSocket
p
- the DatagramPacket to be sentIOException
- if an I/O error occursDatagramSocket.send(DatagramPacket)
Copyright © 2018. All rights reserved.