equip.net
Class ConnectionSapTcp

java.lang.Object
  extended byequip.net.ConnectionSap
      extended byequip.net.ConnectionSapTcp
All Implemented Interfaces:
java.lang.Runnable

public class ConnectionSapTcp
extends ConnectionSap

TCP-based implementation of ConnectionSap. Also supports compression; see equip.net.tcpcompress.


Nested Class Summary
 
Nested classes inherited from class equip.net.ConnectionSap
ConnectionSap.KeepAliveThreadData
 
Field Summary
protected static boolean DEBUG_TCP
           
static java.lang.String DEFAULT_TCP_FILTER
           
static java.lang.String DEFAULT_TCP_FILTER_ARG
           
static java.lang.String DEFAULT_TCP_FILTER_ARG_CONFIGNAME
           
static java.lang.String DEFAULT_TCP_FILTER_CONFIGNAME
           
protected  ObjectInputStream oin
           
protected  ObjectOutputStream oout
           
protected  java.net.Socket socket
           
static int TCP_FILTER_MAGIC
           
 
Fields inherited from class equip.net.ConnectionSap
connectedFlag, connectionTimeoutFlag, connectionTimeoutMs, keepAliveThread, keepAliveThreadData, keepAliveTimeMs, lastNewSendTimeMs, lastResponseTimeMs, lastSendTimeMs, localAddress, localPort, lock, nextObjectId, probingIntervalMs, recvBufSize, recvTimeoutMs, remoteAddress, remotePort, sendBufSize, slowResponseFlag, slowResponseTimeMs, status
 
Constructor Summary
  ConnectionSapTcp(int remoteAddress, short remotePort)
          connect using default StreamFilter (if any)
(package private) ConnectionSapTcp(int remoteAddress, short remotePort, java.net.Socket socket)
           
  ConnectionSapTcp(int remoteAddress, short remotePort, java.lang.String streamFilterClassName, java.lang.String streamFilterArg)
          connect using non-default StreamFilter
 
Method Summary
 int cancelObject(int object_id)
           
 void close(boolean flushFlag)
           
protected  void connect(int remoteAddress, short remotePort)
           
protected  void finalize()
           
 int getProtocol()
           
protected  void init(int remoteAddress, short remotePort, boolean initiatorFlag)
           
protected  void init(int remoteAddress, short remotePort, boolean initiatorFlag, java.lang.String streamFilterClassName, java.lang.String streamFilterArg)
           
 ValueBase readObject()
           
protected  java.lang.String readRawString(java.io.InputStream is)
           
protected  int readShort(java.io.InputStream is)
           
 void setRecvBufSize(int size)
           
 void setRecvTimeout(int timeoutMs)
           
 void setSendBufSize(int size)
           
 int waitUntilConnected()
           
protected  void wrapStreams(java.net.Socket socket, java.io.OutputStream bos, java.io.InputStream bis, IOStreamFilterFactory fact, java.lang.String streamFilterArg)
           
protected  int writeObjectLocked(ValueBase object, boolean reliableFlag, int[] object_id, int priority)
           
protected  void writeRawString(java.io.OutputStream os, java.lang.String string)
           
protected  void writeShort(java.io.OutputStream os, int val)
           
 
Methods inherited from class equip.net.ConnectionSap
close, getConnectedFlag, getConnectionStrength, getConnectionTimeout, getConnectionTimeoutFlag, getKeepAliveTime, getLocalAddress, getLocalPort, getProbingInterval, getRecvBufSize, getRecvTimeout, getRemoteAddress, getRemotePort, getSendBufSize, getSlowResponseFlag, getSlowResponseTime, getStatus, keepAliveThreadFn, noteReceivedObject, resetConnectionTimeoutFlag, run, setConnectionTimeout, setKeepAliveTime, setProbingInterval, setSlowResponseTime, writeObject, writeObject
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TCP_FILTER_CONFIGNAME

public static final java.lang.String DEFAULT_TCP_FILTER_CONFIGNAME
See Also:
Constant Field Values

DEFAULT_TCP_FILTER_ARG_CONFIGNAME

public static final java.lang.String DEFAULT_TCP_FILTER_ARG_CONFIGNAME
See Also:
Constant Field Values

DEFAULT_TCP_FILTER

public static final java.lang.String DEFAULT_TCP_FILTER

DEFAULT_TCP_FILTER_ARG

public static final java.lang.String DEFAULT_TCP_FILTER_ARG

TCP_FILTER_MAGIC

public static final int TCP_FILTER_MAGIC
See Also:
Constant Field Values

socket

protected java.net.Socket socket

oout

protected ObjectOutputStream oout

oin

protected ObjectInputStream oin

DEBUG_TCP

protected static final boolean DEBUG_TCP
See Also:
Constant Field Values
Constructor Detail

ConnectionSapTcp

ConnectionSapTcp(int remoteAddress,
                 short remotePort,
                 java.net.Socket socket)

ConnectionSapTcp

public ConnectionSapTcp(int remoteAddress,
                        short remotePort)
connect using default StreamFilter (if any)


ConnectionSapTcp

public ConnectionSapTcp(int remoteAddress,
                        short remotePort,
                        java.lang.String streamFilterClassName,
                        java.lang.String streamFilterArg)
connect using non-default StreamFilter

Method Detail

connect

protected void connect(int remoteAddress,
                       short remotePort)

init

protected void init(int remoteAddress,
                    short remotePort,
                    boolean initiatorFlag)

init

protected void init(int remoteAddress,
                    short remotePort,
                    boolean initiatorFlag,
                    java.lang.String streamFilterClassName,
                    java.lang.String streamFilterArg)

writeRawString

protected void writeRawString(java.io.OutputStream os,
                              java.lang.String string)
                       throws java.io.IOException
Throws:
java.io.IOException

writeShort

protected void writeShort(java.io.OutputStream os,
                          int val)
                   throws java.io.IOException
Throws:
java.io.IOException

readShort

protected int readShort(java.io.InputStream is)
                 throws java.io.IOException
Throws:
java.io.IOException

readRawString

protected java.lang.String readRawString(java.io.InputStream is)
                                  throws java.io.IOException
Throws:
java.io.IOException

wrapStreams

protected void wrapStreams(java.net.Socket socket,
                           java.io.OutputStream bos,
                           java.io.InputStream bis,
                           IOStreamFilterFactory fact,
                           java.lang.String streamFilterArg)
                    throws java.io.IOException
Throws:
java.io.IOException

finalize

protected void finalize()

getProtocol

public int getProtocol()
Specified by:
getProtocol in class ConnectionSap

waitUntilConnected

public int waitUntilConnected()
Specified by:
waitUntilConnected in class ConnectionSap

close

public void close(boolean flushFlag)
Specified by:
close in class ConnectionSap

readObject

public ValueBase readObject()
                     throws java.io.IOException
Specified by:
readObject in class ConnectionSap
Throws:
java.io.IOException

cancelObject

public int cancelObject(int object_id)
Specified by:
cancelObject in class ConnectionSap

setSendBufSize

public void setSendBufSize(int size)
Overrides:
setSendBufSize in class ConnectionSap

setRecvBufSize

public void setRecvBufSize(int size)
Overrides:
setRecvBufSize in class ConnectionSap

setRecvTimeout

public void setRecvTimeout(int timeoutMs)
Overrides:
setRecvTimeout in class ConnectionSap

writeObjectLocked

protected int writeObjectLocked(ValueBase object,
                                boolean reliableFlag,
                                int[] object_id,
                                int priority)
                         throws java.io.IOException
Specified by:
writeObjectLocked in class ConnectionSap
Throws:
java.io.IOException