com.kenmccrary.jtella
Class Connection

java.lang.Object
  |
  +--com.kenmccrary.jtella.Connection
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
HostCacheConnection, NodeConnection

public abstract class Connection
extends java.lang.Object
implements java.lang.Runnable

Represents a connection to an application communicating with the GNUTella protocol


Field Summary
protected  com.kenmccrary.jtella.Connection.AsyncSender asyncSender
           
static int CONNECTION_INCOMING
          Connection created by another servant
static int CONNECTION_OUTGOING
          Connection created be JTella servant
protected  ConnectionData connectionData
           
protected  long createTime
           
protected  int droppedCount
           
protected  java.lang.String host
           
protected  int inputCount
           
protected  java.io.DataInputStream inputStream
           
protected  int outputCount
           
protected  java.io.DataOutputStream outputStream
           
protected  int port
           
protected  com.kenmccrary.jtella.Router router
           
protected  long sendTime
           
protected  boolean shutdownFlag
           
protected  java.net.Socket socket
           
protected  int status
           
static int STATUS_CONNECTING
          Connection is attempting to connected to GNUTella
static int STATUS_FAILED
          Connection is not operating normally
static int STATUS_OK
          Connection is operating normally
static int STATUS_STOPPED
          Connection has been stopped
protected  int type
           
 
Method Summary
 java.lang.String getConnectedServant()
          Get the connected host
 int getMessageDropCount()
          Get the number of messages dropped on this connection
 int getMessageInput()
          Get the message input count
 int getMessageOutput()
          Get the message output count
 long getSendTime()
          Returns the timestamp of the last send
 int getStatus()
          Get the current status of the connection
 int getType()
          Get the type of connection, incoming or outgoing
 int getUpTime()
          Get the lenght of time the connection has lived
 void shutdown()
          Stops the connection and cleans up
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.lang.Runnable
run
 

Field Detail

STATUS_CONNECTING

public static final int STATUS_CONNECTING
Connection is attempting to connected to GNUTella

STATUS_OK

public static final int STATUS_OK
Connection is operating normally

STATUS_FAILED

public static final int STATUS_FAILED
Connection is not operating normally

STATUS_STOPPED

public static final int STATUS_STOPPED
Connection has been stopped

CONNECTION_INCOMING

public static final int CONNECTION_INCOMING
Connection created by another servant

CONNECTION_OUTGOING

public static final int CONNECTION_OUTGOING
Connection created be JTella servant

shutdownFlag

protected boolean shutdownFlag

socket

protected java.net.Socket socket

inputStream

protected java.io.DataInputStream inputStream

outputStream

protected java.io.DataOutputStream outputStream

asyncSender

protected com.kenmccrary.jtella.Connection.AsyncSender asyncSender

router

protected com.kenmccrary.jtella.Router router

connectionData

protected ConnectionData connectionData

host

protected java.lang.String host

port

protected int port

status

protected int status

type

protected int type

inputCount

protected int inputCount

outputCount

protected int outputCount

droppedCount

protected int droppedCount

createTime

protected long createTime

sendTime

protected long sendTime
Method Detail

shutdown

public void shutdown()
Stops the connection and cleans up

getConnectedServant

public java.lang.String getConnectedServant()
Get the connected host
Returns:
host name

getStatus

public int getStatus()
Get the current status of the connection

getType

public int getType()
Get the type of connection, incoming or outgoing
Returns:
connection type

getMessageOutput

public int getMessageOutput()
Get the message output count
Returns:
output

getMessageInput

public int getMessageInput()
Get the message input count
Returns:
input

getMessageDropCount

public int getMessageDropCount()
Get the number of messages dropped on this connection
Returns:
dropcount

getUpTime

public int getUpTime()
Get the lenght of time the connection has lived
Returns:
time in seconds

getSendTime

public long getSendTime()
Returns the timestamp of the last send
Returns:
timestamp