Project JXTA

net.jxta.impl.endpoint.tcp
Class TcpTransport

java.lang.Object
  |
  +--net.jxta.impl.endpoint.tcp.TcpTransport

public class TcpTransport
extends java.lang.Object
implements TransportProtocol, java.lang.Runnable

This class implements the TCP Transport Protocol


Inner Class Summary
 class TcpTransport.IncomingMulticastThreads
           
 class TcpTransport.IncomingUnicastThreads
           
protected  class TcpTransport.TcpDoPing
           
protected  class TcpTransport.TcpDoPingHandler
           
 
Field Summary
 boolean debug
           
static int DefaultNbOfMulticastThreads
           
static int DefaultNbOfUnicastThreads
           
 Endpoint endpoint
           
static int MaxKeepAliveDelay
           
static int MaxNbOfMulticastThreads
           
static int MaxNbOfPendingSockets
           
static int MaxNbOfUnicastKeepAliveThreads
           
static int MaxNbOfUnicastThreads
           
static java.lang.String multicastAddress
           
static int multicastPacketSize
           
static int multicastPortNb
           
static java.lang.String publicAddress
           
 int serverSocketPort
           
static int unicastPortNb
          This is a portion of the API which might not be useful when the configuration part of the JXTA platform will be completed.
 java.net.ServerSocket unicastSocket
           
 
Constructor Summary
TcpTransport()
           
TcpTransport(net.jxta.protocol.EndpointAdvertisement transport)
           
 
Method Summary
 void close()
          closes this TransportProtocol.
 net.jxta.endpoint.EndpointAddress getLocalAddress()
          Returns an EndpointAddress of the local endpoint manage by the TransportProtocol
 java.net.InetAddress getMcastAddr()
           
 int getMcastPort()
           
 int getMcastSize()
           
 EndpointMessanger getMessanger(net.jxta.endpoint.EndpointAddress dst, java.lang.String peer, int type)
          Creates and return an EndpointMessanger
 int getPort()
           
 java.lang.String getProtocolName()
          Returns a String containing the canonical name of this protocol, as it appears in an EndpointAddress.
 void init(Endpoint ep)
          Initialization of the TcpTransport (called by Platform)
 boolean isConnected()
          Returns true if the Transport Protocol can establish connection to the remote host (like TCP).
 boolean isFast()
          Returns true if the Transport Protocol is fast.
 boolean ping(net.jxta.endpoint.EndpointAddress addr)
          Returns true if the target address is reachable.
 void processMulticast(byte[] buffer)
           
 void propagate(net.jxta.endpoint.Message message, java.lang.String pName, java.lang.String pParams, java.lang.String prunePeer)
          Propagates a TransportMessage on this TransportProtocol
 void run()
           
 void runMulticastServer()
           
 void runReceive(java.net.Socket socket, boolean keep)
           
 void runUnicastServer()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public boolean debug

unicastSocket

public java.net.ServerSocket unicastSocket

serverSocketPort

public int serverSocketPort

endpoint

public Endpoint endpoint

unicastPortNb

public static int unicastPortNb
This is a portion of the API which might not be useful when the configuration part of the JXTA platform will be completed. XXX: to revisit.

multicastAddress

public static java.lang.String multicastAddress

multicastPortNb

public static int multicastPortNb

multicastPacketSize

public static int multicastPacketSize

publicAddress

public static java.lang.String publicAddress

DefaultNbOfUnicastThreads

public static final int DefaultNbOfUnicastThreads

MaxNbOfUnicastThreads

public static final int MaxNbOfUnicastThreads

MaxNbOfUnicastKeepAliveThreads

public static final int MaxNbOfUnicastKeepAliveThreads

MaxKeepAliveDelay

public static final int MaxKeepAliveDelay

DefaultNbOfMulticastThreads

public static final int DefaultNbOfMulticastThreads

MaxNbOfMulticastThreads

public static final int MaxNbOfMulticastThreads

MaxNbOfPendingSockets

public static final int MaxNbOfPendingSockets
Constructor Detail

TcpTransport

public TcpTransport(net.jxta.protocol.EndpointAdvertisement transport)

TcpTransport

public TcpTransport()
Method Detail

getPort

public int getPort()

getMcastAddr

public java.net.InetAddress getMcastAddr()

getMcastPort

public int getMcastPort()

getMcastSize

public int getMcastSize()

init

public void init(Endpoint ep)
Initialization of the TcpTransport (called by Platform)
Specified by:
init in interface TransportProtocol

run

public void run()
Specified by:
run in interface java.lang.Runnable

runUnicastServer

public void runUnicastServer()

runMulticastServer

public void runMulticastServer()

processMulticast

public void processMulticast(byte[] buffer)

runReceive

public void runReceive(java.net.Socket socket,
                       boolean keep)

getMessanger

public EndpointMessanger getMessanger(net.jxta.endpoint.EndpointAddress dst,
                                      java.lang.String peer,
                                      int type)
                               throws java.io.IOException
Creates and return an EndpointMessanger
Specified by:
getMessanger in interface TransportProtocol
Tags copied from interface: TransportProtocol
Parameters:
dest - EndpointAddress of the destination
type - type of the messanger as defined in the class Endpoint
Returns:
an EndpointMessanger.

propagate

public void propagate(net.jxta.endpoint.Message message,
                      java.lang.String pName,
                      java.lang.String pParams,
                      java.lang.String prunePeer)
               throws java.io.IOException
Propagates a TransportMessage on this TransportProtocol
Specified by:
propagate in interface TransportProtocol
Parameters:
message - the TransportMessage to be propagated
pName - the name of a service
pParams - parameters for this message.
prunePeer - ????
Throws:
java.io.IOException - thrown if the message could not be sent for some reason.

getProtocolName

public java.lang.String getProtocolName()
Description copied from interface: TransportProtocol
Returns a String containing the canonical name of this protocol, as it appears in an EndpointAddress.
Specified by:
getProtocolName in interface TransportProtocol
Tags copied from interface: TransportProtocol
Returns:
a String containing the name of the protocol

close

public void close()
closes this TransportProtocol.
Specified by:
close in interface TransportProtocol

getLocalAddress

public net.jxta.endpoint.EndpointAddress getLocalAddress()
Description copied from interface: TransportProtocol
Returns an EndpointAddress of the local endpoint manage by the TransportProtocol
Specified by:
getLocalAddress in interface TransportProtocol
Tags copied from interface: TransportProtocol
Returns:
an EndpointAddress containing the local address

isFast

public boolean isFast()
Description copied from interface: TransportProtocol
Returns true if the Transport Protocol is fast. The notion of being fast is relative, but any mailbox type of protocols should return false.
Specified by:
isFast in interface TransportProtocol

isConnected

public boolean isConnected()
Description copied from interface: TransportProtocol
Returns true if the Transport Protocol can establish connection to the remote host (like TCP).
Specified by:
isConnected in interface TransportProtocol

ping

public boolean ping(net.jxta.endpoint.EndpointAddress addr)
Description copied from interface: TransportProtocol
Returns true if the target address is reachable. Otherwise returns false.
Specified by:
ping in interface TransportProtocol

Project JXTA