|
|||||||||
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
public class GameSocket
Class to abstract dealing with sockets and streams away from the Vooga networking API users so they can simply send() and receive() messages from a socket.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
protected java.io.PrintStream |
outStream
|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
GameSocket(java.net.Socket sock)
Save the socket as well as it's input and output streams. |
Method Summary | |
---|---|
void |
closeConnections()
Close the socket. |
protected void |
finalize()
Make sure the socket is closed and if not close it. |
boolean |
isConnected()
Return if the GameSocket is still connected, meaning it can read and write from and to a socket. |
java.lang.String |
receive()
Read the latest message from the socket. |
void |
run()
|
void |
send(java.lang.String s)
Send a message to the socket. |
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 |
Field Detail |
---|
protected java.io.PrintStream outStream
Constructor Detail |
---|
public GameSocket(java.net.Socket sock)
sock
- the socket to communicate through.Method Detail |
---|
public void send(java.lang.String s)
s
- the message to sendpublic java.lang.String receive() throws java.io.IOException
java.io.IOException
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public boolean isConnected()
public void closeConnections()
protected void finalize()
finalize
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |