|
Ver. 20060815 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectServer.ConnectionContainer
public abstract class ConnectionContainer
Abstract encapsulation of an incoming socket connection. Maintains the state of the connection within the server. Provides the API for all incomming connections. Can be inherited to create specialized connection types. 2006/08/10 Kyle Reed
Field Summary | |
---|---|
protected byte[] |
ba
|
protected java.nio.ByteBuffer |
bb
|
protected int |
challengeNum
|
protected boolean |
connected
|
protected java.lang.String |
idName
|
protected int |
idNum
|
protected java.nio.channels.SocketChannel |
io
|
protected java.nio.channels.SelectionKey |
myKey
|
(package private) static Server |
server
|
protected java.util.Date |
startTime
|
private static int |
totalConnections
|
Constructor Summary | |
---|---|
ConnectionContainer(java.nio.channels.SelectionKey key)
Creates a generic container for an incoming connection. |
Method Summary | |
---|---|
int |
getChallengeNum()
Returns the object's challenge number. |
int |
getIdNum()
Returns the container's UID. |
java.lang.String |
getName()
Returns the object's display name. |
long |
getUptime()
Returns the object's connected time in seconds. |
abstract void |
handleInput()
Tells the container to read its input from io socket and process it accordingly. |
abstract void |
selfDestruct()
Abstract method to get the object's data structures ready for garbage collection. |
void |
sendTerminator()
Send the close tag to the output stream to let the client know that the connection is about to be closed. |
void |
setName(java.lang.String s)
Sets the object's display name. |
static void |
setServer(Server s)
|
void |
writeToSelf(java.lang.String s)
Writes a string out on the SocketChannel output stream that belongs to the SelectionKey passed to the constructor. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static int totalConnections
static Server server
protected java.nio.channels.SelectionKey myKey
protected int idNum
protected java.lang.String idName
protected java.util.Date startTime
protected int challengeNum
protected boolean connected
protected java.nio.channels.SocketChannel io
protected java.nio.ByteBuffer bb
protected byte[] ba
Constructor Detail |
---|
public ConnectionContainer(java.nio.channels.SelectionKey key)
Method Detail |
---|
public static void setServer(Server s)
public abstract void handleInput()
public void writeToSelf(java.lang.String s)
public void sendTerminator()
public abstract void selfDestruct()
public int getIdNum()
public int getChallengeNum()
public long getUptime()
public java.lang.String getName()
public void setName(java.lang.String s)
|
Ver. 20060815 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |