Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.service.neomedia
Class DefaultTCPStreamConnector

java.lang.Object
  extended by net.java.sip.communicator.service.neomedia.DefaultTCPStreamConnector
All Implemented Interfaces:
StreamConnector

public class DefaultTCPStreamConnector
extends Object
implements StreamConnector

Represents a default implementation of StreamConnector which is initialized with a specific pair of control and data Sockets and which closes them (if they exist) when its close() is invoked.

Author:
Lubomir Marinov, Sebastien Vincent

Nested Class Summary
 
Nested classes/interfaces inherited from interface net.java.sip.communicator.service.neomedia.StreamConnector
StreamConnector.Protocol
 
Field Summary
protected  Socket controlSocket
          The Socket that a stream should use for control data (e.g.
protected  Socket dataSocket
          The Socket that a stream should use for data (e.g.
 
Constructor Summary
DefaultTCPStreamConnector()
          Initializes a new DefaultTCPStreamConnector instance with no control and data Sockets.
DefaultTCPStreamConnector(Socket dataSocket, Socket controlSocket)
          Initializes a new DefaultTCPStreamConnector instance which is to represent a specific pair of control and data Sockets.
 
Method Summary
 void close()
          Releases the resources allocated by this instance in the course of its execution and prepares it to be garbage collected.
 DatagramSocket getControlSocket()
          Returns a reference to the DatagramSocket that a stream should use for control data (e.g.
 Socket getControlTCPSocket()
          Returns a reference to the Socket that a stream should use for control data (e.g.
 DatagramSocket getDataSocket()
          Returns a reference to the DatagramSocket that a stream should use for data (e.g.
 Socket getDataTCPSocket()
          Returns a reference to the Socket that a stream should use for data (e.g.
 StreamConnector.Protocol getProtocol()
          Returns the protocol of this StreamConnector.
 void started()
          Notifies this instance that utilization of its Sockets for data and/or control traffic has started.
 void stopped()
          Notifies this instance that utilization of its Sockets for data and/or control traffic has temporarily stopped.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

controlSocket

protected Socket controlSocket
The Socket that a stream should use for control data (e.g. RTCP) traffic.


dataSocket

protected Socket dataSocket
The Socket that a stream should use for data (e.g. RTP) traffic.

Constructor Detail

DefaultTCPStreamConnector

public DefaultTCPStreamConnector()
Initializes a new DefaultTCPStreamConnector instance with no control and data Sockets.

Suitable for extenders willing to delay the creation of the control and data sockets. For example, they could override getControlSocket() and/or getDataSocket() and create them on demand.


DefaultTCPStreamConnector

public DefaultTCPStreamConnector(Socket dataSocket,
                                 Socket controlSocket)
Initializes a new DefaultTCPStreamConnector instance which is to represent a specific pair of control and data Sockets.

Parameters:
dataSocket - the Socket to be used for data (e.g. RTP) traffic
controlSocket - the Socket to be used for control data (e.g. RTCP) traffic
Method Detail

close

public void close()
Releases the resources allocated by this instance in the course of its execution and prepares it to be garbage collected.

Specified by:
close in interface StreamConnector
See Also:
StreamConnector.close()

getControlSocket

public DatagramSocket getControlSocket()
Returns a reference to the DatagramSocket that a stream should use for control data (e.g. RTCP) traffic.

Specified by:
getControlSocket in interface StreamConnector
Returns:
a reference to the DatagramSocket that a stream should use for control data (e.g. RTCP) traffic
See Also:
StreamConnector.getControlSocket()

getDataSocket

public DatagramSocket getDataSocket()
Returns a reference to the DatagramSocket that a stream should use for data (e.g. RTP) traffic.

Specified by:
getDataSocket in interface StreamConnector
Returns:
a reference to the DatagramSocket that a stream should use for data (e.g. RTP) traffic
See Also:
StreamConnector.getDataSocket()

getDataTCPSocket

public Socket getDataTCPSocket()
Returns a reference to the Socket that a stream should use for data (e.g. RTP) traffic.

Specified by:
getDataTCPSocket in interface StreamConnector
Returns:
a reference to the Socket that a stream should use for data (e.g. RTP) traffic.

getControlTCPSocket

public Socket getControlTCPSocket()
Returns a reference to the Socket that a stream should use for control data (e.g. RTCP).

Specified by:
getControlTCPSocket in interface StreamConnector
Returns:
a reference to the Socket that a stream should use for control data (e.g. RTCP).

getProtocol

public StreamConnector.Protocol getProtocol()
Returns the protocol of this StreamConnector.

Specified by:
getProtocol in interface StreamConnector
Returns:
the protocol of this StreamConnector

started

public void started()
Notifies this instance that utilization of its Sockets for data and/or control traffic has started.

Specified by:
started in interface StreamConnector
See Also:
StreamConnector.started()

stopped

public void stopped()
Notifies this instance that utilization of its Sockets for data and/or control traffic has temporarily stopped. This instance should be prepared to be started at a later time again though.

Specified by:
stopped in interface StreamConnector
See Also:
StreamConnector.stopped()

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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