|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.lang.Thread
j_waste.network.Connection
This is the Connection class for creating and maintaing TCP connections.
| Field Summary |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
Connection(java.net.InetAddress hostAddr,
int hostPort,
SynchronizedPrioQueue pq)
Main constructor of the Connection class. |
|
Connection(java.net.Socket s,
SynchronizedPrioQueue pq)
Alternative constructor of the Connection class. |
|
| Method Summary | |
void |
close()
Closes this Connection gracefully. |
java.io.InputStream |
getInput()
Returns the InputStream of this Connection. |
java.io.OutputStream |
getOutput()
Returns the OutputStream of this Connection. |
int |
getPort()
Returns the remote Port number of this Connection. |
boolean |
isConnected()
Returns the connected status of this Connection. |
boolean |
isRunning()
Returns the running status of this Connection. |
void |
run()
Main loop of this Connection. |
void |
send(HeadedPacket p)
Sends a packet on this Connection. |
void |
sendDecrypted(Packet p)
Sends a packet on this Connection that is not encrypted. |
void |
sendDirect(Packet p)
Sends a packet directly, this method is not thread-safe. |
void |
setBlowfish(Blowfish bf)
Sets the blowfish object for this Connection. |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Connection(java.net.InetAddress hostAddr,
int hostPort,
SynchronizedPrioQueue pq)
throws java.io.IOException,
java.net.ConnectException
hostAddr - the InetAddress of the host.hostPort - the Port number on the host.pq - the PriorityQueue to use.
java.io.IOException - upon socket failure.
java.net.ConnectException - connection failure.
public Connection(java.net.Socket s,
SynchronizedPrioQueue pq)
throws java.net.ConnectException,
java.io.IOException
s - the Socket for this Connection.pq - the PriorityQueue to use.
java.net.ConnectException - upon connection failure.
java.io.IOException - upon socket failure.| Method Detail |
public void setBlowfish(Blowfish bf)
public java.io.InputStream getInput()
throws java.io.IOException
java.io.IOException
public java.io.OutputStream getOutput()
throws java.io.IOException
java.io.IOExceptionpublic int getPort()
public boolean isConnected()
public void send(HeadedPacket p)
throws java.io.IOException
p - the Packet to send.
java.io.IOException - on failure.
public void sendDirect(Packet p)
throws java.io.IOException
p - the Packet to send.
java.io.IOException - on error.
public void sendDecrypted(Packet p)
throws java.io.IOException
p - the Packet to send.
java.io.IOException - on failure.public boolean isRunning()
public void close()
throws java.io.IOException
java.io.IOExceptionpublic void run()
run in interface java.lang.Runnable
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||