|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--protocol.Connection
Class to manage the connection between a player and the ICFP-2002 programming server.
Constructor Summary | |
Connection(Socket socket)
Creates a connection between a player and the game server (on the argument socket). |
|
Connection(Socket socket,
PrintStream tracePrintStream)
Creates a connection between a player and the game server (on the argument socket). |
Method Summary | |
BufferedReader |
getReader()
Method to get a reader for the connection socket. |
Socket |
getSocket()
Method to get the Socket used for communicating to the
game server on this connection. |
protected PrintWriter |
getWriter()
Method to get a writer for the connection socket. |
String |
read()
Read a line of text from the game server discarding line terminator(s). |
void |
send(Object object)
Sends the argument object (by invoking its Object.toString() method) to the server with the proper
line terminator(s). |
void |
send(String string)
Sends the argument string to the server with the proper line terminator(s). |
Methods inherited from class java.lang.Object |
|
Constructor Detail |
public Connection(Socket socket, PrintStream tracePrintStream)
socket
- The socket connecting the player to the
game server.trace
- True if communications with the server
should be tracedpublic Connection(Socket socket)
socket
- The socket connecting the player to the
game server.Method Detail |
public Socket getSocket()
Socket
used for communicating to the
game server on this connection.public BufferedReader getReader() throws IOException
IOException
- Thrown if an exception is encountered
communicating on the connection.public String read() throws IOException
IOException
- Thrown if an exception is encountered
communicating on the connection.protected PrintWriter getWriter() throws IOException
IOException
- Thrown if an exception is encountered
communicating on the connection.public void send(String string) throws IOException
string
- The string to be sent to the game
server.IOException
- Thrown if an exception is encountered
communicating on the connection.public void send(Object object) throws IOException
Object.toString()
method) to the server with the proper
line terminator(s).object
- The object to be sent to the game
server.IOException
- Thrown if an exception is encountered
communicating on the connection.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |