-
- All Implemented Interfaces:
-
java.io.Closeable,java.lang.AutoCloseable
public class GoogleRelayedCandidateSocket extends DelegatingSocket
Represents an application-purposed (as opposed to an ICE-specific) Socket for a RelayedCandidate harvested by a TurnCandidateHarvest (and its associated TurnCandidateHarvester, of course). GoogleRelayedCandidateSocket is associated with a successful Allocation on a TURN server and implements sends and receives through it using TURN messages to and from that TURN server.
-
-
Field Summary
Fields Modifier and Type Field Description private final GoogleRelayedCandidaterelayedCandidate
-
Constructor Summary
Constructors Constructor Description GoogleRelayedCandidateSocket(GoogleRelayedCandidate relayedCandidate, GoogleTurnCandidateHarvest turnCandidateHarvest, String username)Initializes a new GoogleRelayedCandidateSocket instance which is to be the socket of a specific RelayedCandidate harvested by a specific TurnCandidateHarvest.
-
Method Summary
Modifier and Type Method Description final GoogleRelayedCandidategetRelayedCandidate()Gets the RelayedCandidate which uses this instance as the value of its socket property. voidclose()Closes this datagram socket. InetAddressgetLocalAddress()Gets the local address to which the socket is bound. intgetLocalPort()Returns the port number on the local host to which this socket is bound. InetSocketAddressgetLocalSocketAddress()Returns the address of the endpoint this socket is bound to, or null if it is not bound yet. voidprocessSuccess(Response response, Request request)Notifies this GoogleRelayedCandidateSocket that a specific Request it has sent has received a STUN success Response. voidprocessResponse(StunResponseEvent response)Dispatch the specified response. voidreceive(DatagramPacket p)Receives a datagram packet from this socket. voidsend(DatagramPacket p)Sends a datagram packet from this socket. -
Methods inherited from class org.ice4j.socket.DelegatingSocket
bind, connect, connect, getChannel, getInetAddress, getInputStream, getKeepAlive, getOOBInline, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoLinger, getSoTimeout, getTcpNoDelay, getTrafficClass, isBound, isClosed, isConnected, isInputShutdown, isOutputShutdown, receiveFromInputStream, sendUrgentData, setKeepAlive, setOOBInline, setOriginalInputStream, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSoLinger, setSoTimeout, setTcpNoDelay, setTrafficClass, shutdownInput, shutdownOutput, toString -
Methods inherited from class java.net.Socket
bind, close, connect, getChannel, getInetAddress, getInputStream, getKeepAlive, getLocalAddress, getLocalPort, getLocalSocketAddress, getOOBInline, getOption, getOutputStream, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoLinger, getSoTimeout, getTcpNoDelay, getTrafficClass, isBound, isClosed, isConnected, isInputShutdown, isOutputShutdown, sendUrgentData, setKeepAlive, setOOBInline, setOption, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSoLinger, setSoTimeout, setSocketImplFactory, setTcpNoDelay, setTrafficClass, shutdownInput, shutdownOutput, supportedOptions, toString -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
GoogleRelayedCandidateSocket
GoogleRelayedCandidateSocket(GoogleRelayedCandidate relayedCandidate, GoogleTurnCandidateHarvest turnCandidateHarvest, String username)
Initializes a new GoogleRelayedCandidateSocket instance which is to be the socket of a specific RelayedCandidate harvested by a specific TurnCandidateHarvest.- Parameters:
relayedCandidate- the RelayedCandidate which is to use the new instance as the value of its socket propertyturnCandidateHarvest- the TurnCandidateHarvest which has harvested relayedCandidateusername- username
-
-
Method Detail
-
getRelayedCandidate
final GoogleRelayedCandidate getRelayedCandidate()
Gets the RelayedCandidate which uses this instance as the value of its socket property.
-
close
void close()
Closes this datagram socket.
-
getLocalAddress
InetAddress getLocalAddress()
Gets the local address to which the socket is bound. GoogleRelayedCandidateSocket returns the address of its localSocketAddress.
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.
-
getLocalPort
int getLocalPort()
Returns the port number on the local host to which this socket is bound. GoogleRelayedCandidateSocket returns the port of its localSocketAddress.
-
getLocalSocketAddress
InetSocketAddress getLocalSocketAddress()
Returns the address of the endpoint this socket is bound to, or null if it is not bound yet. Since GoogleRelayedCandidateSocket represents an application-purposed Socket relaying data to and from a TURN server, the localSocketAddress is the transportAddress of the respective RelayedCandidate.
-
processSuccess
void processSuccess(Response response, Request request)
Notifies this GoogleRelayedCandidateSocket that a specific Request it has sent has received a STUN success Response.
- Parameters:
response- the Response which responds to requestrequest- the Request sent by this instance to which response responds
-
processResponse
void processResponse(StunResponseEvent response)
Dispatch the specified response.
- Parameters:
response- the response to dispatch.
-
receive
void receive(DatagramPacket p)
Receives a datagram packet from this socket. When this method returns, the DatagramPacket's buffer is filled with the data received. The datagram packet also contains the sender's IP address, and the port number on the sender's machine.
- Parameters:
p- the DatagramPacket into which to place the incoming data
-
send
void send(DatagramPacket p)
Sends a datagram packet from this socket. The DatagramPacket includes information indicating the data to be sent, its length, the IP address of the remote host, and the port number on the remote host.
- Parameters:
p- the DatagramPacket to be sent
-
-
-
-