|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
vooga.engine.networking.GameSocket
vooga.engine.networking.client.ClientConnection
public class ClientConnection
Basic class for connecting to the server from the client and sending and receiving data. Works for basic games but can be extended to add more complicated functionality. Override the getData() method to deal with receiving messages from the socket and the sendData() method for sending messages to the socket.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class vooga.engine.networking.GameSocket |
---|
outStream |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
ClientConnection(java.lang.String name)
Calls GameSocket constructor with the server's IP address and the port. |
Method Summary | |
---|---|
java.lang.String |
getData()
Listen for incoming data for the game. |
void |
sendData(Serializeable data)
Send a Serializeable object over the network. |
void |
sendGameOver()
Tell the server that the game is over. |
Methods inherited from class vooga.engine.networking.GameSocket |
---|
closeConnections, finalize, isConnected, receive, run, send |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ClientConnection(java.lang.String name) throws java.net.UnknownHostException, java.io.IOException
name
- the name of the game you're trying to connect to and from
java.net.UnknownHostException
java.io.IOException
Method Detail |
---|
public java.lang.String getData()
public void sendData(Serializeable data)
data
- the Serializeable object sent over the networkpublic void sendGameOver()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |