Package 

Class RelayedCandidateDatagramSocket

  • All Implemented Interfaces:
    java.io.Closeable , java.lang.AutoCloseable , org.ice4j.stack.MessageEventHandler

    
    public class RelayedCandidateDatagramSocket
    extends DatagramSocket implements MessageEventHandler
                        

    Represents an application-purposed (as opposed to an ICE-specific) DatagramSocket for a RelayedCandidate harvested by a TurnCandidateHarvest (and its associated TurnCandidateHarvester, of course). RelayedCandidateDatagramSocket 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 RelayedCandidate 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 handleMessageEvent(StunMessageEvent e) Notifies this MessageEventHandler that a specific STUN message has been received, parsed and is ready for delivery.
      boolean processErrorOrFailure(Response response, Request request) Notifies this RelayedCandidateDatagramSocket that a specific Request it has sent has either failed or received a STUN error Response.
      void processSuccess(Response response, Request request) Notifies this RelayedCandidateDatagramSocket 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.
      • 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

      • RelayedCandidateDatagramSocket

        RelayedCandidateDatagramSocket(RelayedCandidate relayedCandidate, TurnCandidateHarvest turnCandidateHarvest)
        Initializes a new RelayedCandidateDatagramSocket 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
    • Method Detail

      • close

         void close()

        Closes this datagram socket.

      • getLocalAddress

         InetAddress getLocalAddress()

        Gets the local address to which the socket is bound. RelayedCandidateDatagramSocket 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. RelayedCandidateDatagramSocket 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 RelayedCandidateDatagramSocket represents an application-purposed DatagramSocket relaying data to and from a TURN server, the localSocketAddress is the transportAddress of the respective RelayedCandidate.

      • handleMessageEvent

         void handleMessageEvent(StunMessageEvent e)

        Notifies this MessageEventHandler that a specific STUN message has been received, parsed and is ready for delivery. RelayedCandidateDatagramSocket handles STUN indications sent from the associated TURN server and received at the associated local TransportAddress.

        Parameters:
        e - a StunMessageEvent which encapsulates the received STUN message
      • processErrorOrFailure

         boolean processErrorOrFailure(Response response, Request request)

        Notifies this RelayedCandidateDatagramSocket that a specific Request it has sent has either failed or received a STUN error Response.

        Parameters:
        response - the Response which responds to request
        request - the Request sent by this instance to which response responds
      • processSuccess

         void processSuccess(Response response, Request request)

        Notifies this RelayedCandidateDatagramSocket 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