Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.jabber
Class JingleNodesCandidateDatagramSocket

java.lang.Object
  extended by java.net.DatagramSocket
      extended by net.java.sip.communicator.impl.protocol.jabber.JingleNodesCandidateDatagramSocket

public class JingleNodesCandidateDatagramSocket
extends DatagramSocket

Represents an application-purposed (as opposed to an ICE-specific) DatagramSocket for a JingleNodesCandidate.

Author:
Sebastien Vincent

Constructor Summary
JingleNodesCandidateDatagramSocket(JingleNodesCandidate jingleNodesCandidate, org.ice4j.TransportAddress localEndPoint)
          Initializes a new JingleNodesdCandidateDatagramSocket instance which is to be the socket of a specific JingleNodesCandidate.
 
Method Summary
 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 send(DatagramPacket p)
          Sends a datagram packet from this socket.
 
Methods inherited from class java.net.DatagramSocket
bind, close, connect, connect, disconnect, getBroadcast, getChannel, getInetAddress, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoTimeout, getTrafficClass, isBound, isClosed, isConnected, receive, setBroadcast, setDatagramSocketImplFactory, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSoTimeout, setTrafficClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JingleNodesCandidateDatagramSocket

public JingleNodesCandidateDatagramSocket(JingleNodesCandidate jingleNodesCandidate,
                                          org.ice4j.TransportAddress localEndPoint)
                                   throws SocketException
Initializes a new JingleNodesdCandidateDatagramSocket instance which is to be the socket of a specific JingleNodesCandidate.

Parameters:
jingleNodesCandidate - the JingleNodesCandidate which is to use the new instance as the value of its socket property
localEndPoint - TransportAddress of the Jingle Nodes relay where we will send our packet.
Throws:
SocketException - if anything goes wrong while initializing the new JingleNodesCandidateDatagramSocket instance
Method Detail

send

public void send(DatagramPacket p)
          throws IOException
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.

Overrides:
send in class DatagramSocket
Parameters:
p - the DatagramPacket to be sent
Throws:
IOException - if an I/O error occurs
See Also:
DatagramSocket.send(DatagramPacket)

getLocalAddress

public InetAddress getLocalAddress()
Gets the local address to which the socket is bound. JingleNodesCandidateDatagramSocket 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.

Overrides:
getLocalAddress in class DatagramSocket
Returns:
the local address to which the socket is bound, or an InetAddress representing any local address if either the socket is not bound, or the security manager checkConnect method does not allow the operation
See Also:
getLocalSocketAddress(), DatagramSocket.getLocalAddress()

getLocalPort

public int getLocalPort()
Returns the port number on the local host to which this socket is bound. JingleNodesCandidateDatagramSocket returns the port of its localSocketAddress.

Overrides:
getLocalPort in class DatagramSocket
Returns:
the port number on the local host to which this socket is bound
See Also:
getLocalSocketAddress(), DatagramSocket.getLocalPort()

getLocalSocketAddress

public InetSocketAddress getLocalSocketAddress()
Returns the address of the endpoint this socket is bound to, or null if it is not bound yet. Since JingleNodesCandidateDatagramSocket represents an application-purposed DatagramSocket relaying data to and from a Jingle Nodes relay, the localSocketAddress is the transportAddress of respective JingleNodesCandidate.

Overrides:
getLocalSocketAddress in class DatagramSocket
Returns:
a SocketAddress representing the local endpoint of this socket, or null if it is not bound yet
See Also:
DatagramSocket.getLocalSocketAddress()

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.