org.beepcore.beep.transport.tcp
Class TCPSession

java.lang.Object
  extended byorg.beepcore.beep.core.SessionImpl
      extended byorg.beepcore.beep.transport.tcp.TCPSession
All Implemented Interfaces:
Session

public class TCPSession
extends SessionImpl

Provides the TCP transport mapping for BEEP according to RFC 3081.


Field Summary
 
Fields inherited from interface org.beepcore.beep.core.Session
SESSION_STATE_ABORTED, SESSION_STATE_ACTIVE, SESSION_STATE_CLOSE_PENDING, SESSION_STATE_CLOSED, SESSION_STATE_CLOSING, SESSION_STATE_GREETING_SENT, SESSION_STATE_INITIALIZED, SESSION_STATE_TUNING, SESSION_STATE_TUNING_PENDING
 
Method Summary
 void close()
          Closes the Session gracefully.
static TCPSession createInitiator(java.net.Socket sock, ProfileRegistry registry)
          Creates a TCPSession for a Socket that was created by initiating a connection.
static TCPSession createInitiator(java.net.Socket sock, ProfileRegistry registry, java.lang.String servername)
          Creates a TCPSession for a Socket that was created by initiating a connection.
static TCPSession createListener(java.net.Socket sock, ProfileRegistry registry)
          Creates a TCPSession for a Socket that was created by listening and accepting a connection.
protected  void disableIO()
          Method disableIO
protected  void enableIO()
          Method enableIO
protected  int getMaxFrameSize()
          Returns the maximum frame size that a channel should send for this session.
 java.net.Socket getSocket()
           
protected  Session reset(SessionCredential localCred, SessionCredential peerCred, SessionTuningProperties tuning, ProfileRegistry reg, java.lang.Object argument)
          This method is used by a tuning profile to reset the session after the tuning is complete.
protected  void sendFrame(Frame f)
          Generates a header, then writes the header, payload, and trailer to the wire.
 void terminate(java.lang.String reason)
          This method is used to terminate the session when there is an non-recoverable error in the BEEP protocol (framing error, etc.).
 java.lang.String toString()
           
protected  boolean updateMyReceiveBufferSize(Channel channel, long currentSeq, int currentAvail)
          Update the channel window size with the remote peer by sending SEQ frames as per RFC 3081.
 
Methods inherited from class org.beepcore.beep.core.SessionImpl
addChannelListener, addSessionListener, createFrame, fireSessionReset, getChannelAvailableWindow, getChannelNumberAsString, getLocalCredential, getPeerCredential, getPeerSupportedProfiles, getProfileRegistry, getServerName, getState, getTuningProperties, init, isInitiator, postFrame, removeChannelListener, removeSessionListener, setLocalCredential, setPeerCredential, setTuningProperties, startChannel, startChannel, startChannel, startChannel, startChannel, startChannel, startChannel, startChannel, tuningInit, updatePeerReceiveBufferSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

createInitiator

public static TCPSession createInitiator(java.net.Socket sock,
                                         ProfileRegistry registry,
                                         java.lang.String servername)
                                  throws BEEPException
Creates a TCPSession for a Socket that was created by initiating a connection.

Parameters:
sock -
registry -
servername -
Throws:
BEEPException

createInitiator

public static TCPSession createInitiator(java.net.Socket sock,
                                         ProfileRegistry registry)
                                  throws BEEPException
Creates a TCPSession for a Socket that was created by initiating a connection.

Parameters:
sock -
registry -
Throws:
BEEPException

createListener

public static TCPSession createListener(java.net.Socket sock,
                                        ProfileRegistry registry)
                                 throws BEEPException
Creates a TCPSession for a Socket that was created by listening and accepting a connection.

Parameters:
sock -
registry -
Throws:
BEEPException

close

public void close()
           throws BEEPException
Description copied from class: SessionImpl
Closes the Session gracefully. The profiles for the open channels on the session may veto the close request.

Specified by:
close in interface Session
Overrides:
close in class SessionImpl
Throws:
BEEPException

getSocket

public java.net.Socket getSocket()

terminate

public void terminate(java.lang.String reason)
Description copied from class: SessionImpl
This method is used to terminate the session when there is an non-recoverable error in the BEEP protocol (framing error, etc.).

Specified by:
terminate in interface Session
Overrides:
terminate in class SessionImpl
Parameters:
reason -

toString

public java.lang.String toString()
Overrides:
toString in class SessionImpl

disableIO

protected void disableIO()
Description copied from class: SessionImpl
Method disableIO

Specified by:
disableIO in class SessionImpl

enableIO

protected void enableIO()
Description copied from class: SessionImpl
Method enableIO

Specified by:
enableIO in class SessionImpl

getMaxFrameSize

protected int getMaxFrameSize()
Description copied from class: SessionImpl
Returns the maximum frame size that a channel should send for this session.

Specified by:
getMaxFrameSize in class SessionImpl

sendFrame

protected void sendFrame(Frame f)
                  throws BEEPException
Generates a header, then writes the header, payload, and trailer to the wire.

Specified by:
sendFrame in class SessionImpl
Parameters:
f - the Frame to send.
Returns:
boolean true of the frame was sent, false otherwise.
Throws:
BEEPException

reset

protected Session reset(SessionCredential localCred,
                        SessionCredential peerCred,
                        SessionTuningProperties tuning,
                        ProfileRegistry reg,
                        java.lang.Object argument)
                 throws BEEPException
Description copied from class: SessionImpl
This method is used by a tuning profile to reset the session after the tuning is complete.

Specified by:
reset in class SessionImpl
Returns:
A new Session with the tuning complete.
Throws:
BEEPException

updateMyReceiveBufferSize

protected boolean updateMyReceiveBufferSize(Channel channel,
                                            long currentSeq,
                                            int currentAvail)
                                     throws BEEPException
Update the channel window size with the remote peer by sending SEQ frames as per RFC 3081.

Specified by:
updateMyReceiveBufferSize in class SessionImpl
Parameters:
channel -
currentSeq -
currentAvail -
Returns:
true if the Receive Buffer Size was updated
Throws:
BEEPException - if a specified buffer size is larger than what's available on the Socket.


Copyright ? 2001 Invisible Worlds, Inc. All Rights Reserved.