Package 

Class GoogleRelayedCandidateDatagramSocket

  • All Implemented Interfaces:
    java.io.Closeable , java.lang.AutoCloseable

    
    public class GoogleRelayedCandidateDatagramSocket
    extends DatagramSocket
                        

    Represents an application-purposed (as opposed to an ICE-specific) DatagramSocket for a RelayedCandidate harvested by a TurnCandidateHarvest (and its associated TurnCandidateHarvester, of course). GoogleRelayedCandidateDatagramSocket 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.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final GoogleRelayedCandidate getRelayedCandidate() Gets the RelayedCandidate which uses this instance as the value of its socket property.
      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.
      void processSuccess(Response response, Request request) Notifies this GoogleRelayedCandidateDatagramSocket that a specific Request it has sent has received a STUN success Response.
      void processResponse(StunResponseEvent response) Dispatch the specified response.
      void receive(DatagramPacket p) Receives a datagram packet from this socket.
      void send(DatagramPacket p) Sends a datagram packet from this socket.
      • Methods inherited from class java.net.DatagramSocket

        bind, connect, disconnect, getBroadcast, getChannel, getInetAddress, getOption, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoTimeout, getTrafficClass, isBound, isClosed, isConnected, setBroadcast, setDatagramSocketImplFactory, setOption, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSoTimeout, setTrafficClass, supportedOptions
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GoogleRelayedCandidateDatagramSocket

        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.
        Parameters:
        relayedCandidate - the RelayedCandidate which is to use the new instance as the value of its socket property
        turnCandidateHarvest - the TurnCandidateHarvest which has harvested relayedCandidate
        username - username
    • Method Detail

      • close

         void close()

        Closes this datagram socket.

      • getLocalAddress

         InetAddress getLocalAddress()

        Gets the local address to which the socket is bound. GoogleRelayedCandidateDatagramSocket 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. GoogleRelayedCandidateDatagramSocket 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 GoogleRelayedCandidateDatagramSocket represents an application-purposed DatagramSocket 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 GoogleRelayedCandidateDatagramSocket that a specific Request it has sent has received a STUN success Response.

        Parameters:
        response - the Response which responds to request
        request - the Request sent by this instance to which response responds
      • 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