|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface IConnection
interface for connections between client and server refactored from the original Connection class which was moved to AbstractConnection
| Method Summary | |
|---|---|
void |
addConnectionListener(ConnectionListener listener)
Adds the specified connection listener to receive connection events from connection. |
long |
bytesReceived()
Returns a very approximate count of how many bytes were received |
long |
bytesSent()
Returns a very approximate count of how many bytes were sent |
void |
close()
Closes the socket and releases resources |
void |
flush()
sibling of the update() method. will not read anything, will just flush the pending packets from the queue |
int |
getId()
Returns the connection ID |
java.lang.String |
getInetAddress()
|
boolean |
hasPending()
Returns true if there are (send)pending packets |
boolean |
open()
Opens the connection |
void |
removeConnectionListener(ConnectionListener listener)
Removes the specified connection listener. |
void |
send(Packet packet)
Adds a packet to the send queue to be send on a seperate thread. |
void |
setId(int id)
Sets the connection ID |
long |
update()
call this to update the connection state. should be called a few times per second normally. |
| Method Detail |
|---|
boolean open()
true on success, false otherwisevoid close()
int getId()
void setId(int id)
id - new connection ID Be careful with this... used by server only.
cannot be moved to constructor,so should be moved to a
separate interfacejava.lang.String getInetAddress()
long update()
void flush()
void send(Packet packet)
boolean hasPending()
true if there are (send)pending packets
true if there are pending packetslong bytesSent()
long bytesReceived()
void addConnectionListener(ConnectionListener listener)
listener - the connection listener.void removeConnectionListener(ConnectionListener listener)
listener - the connection listener.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||