All Packages Class Hierarchy This Package Previous Next Index
Class game.GameLink
java.lang.Object
|
+----java.lang.Thread
|
+----game.GameLink
- public class GameLink
- extends Thread
- implements GameLinkConstants
The GameLink class implements the actual connection
between the Server and its Clients. It is based on the use
of reliable Sockets. [FINISH ME]
-
connected
-
-
debug
-
if true, enables the printing of debug informations on the console.
-
is
-
-
listeners
-
-
os
-
-
socket
- The socket used for the link.
-
GameLink(Socket)
- Creates a new GameLink, wrapping around the given Socket.
-
addGameLinkListener(GameLinkListener, Object)
- Adds the specified listener to the sets of listeners of this
GameLink
object.
-
close()
- Close this
GameLink
link.
-
deleteGameLinkListener(GameLinkListener, Object)
- Removes the specified listener from the sets of listeners of this
GameLink
object for the given game id.
-
isConnected()
- Tells whether the connection is still alive.
-
notifyListeners(LinkFrame)
- experimental.
-
receive()
- experimental.
-
run()
- Run! Run! [DESCRIBE ME]
-
send(LinkFrame)
- experimental.
-
sendBlindly(LinkFrame)
- experimental.
socket
Socket socket
- The socket used for the link.
is
InputStream is
os
OutputStream os
debug
boolean debug
- if true, enables the printing of debug informations on the console.
listeners
Hashtable listeners
connected
boolean connected
GameLink
public GameLink(Socket socket) throws SocketException
- Creates a new GameLink, wrapping around the given Socket.
- Parameters:
- socket - the Socket to be used for data exchange on the link.
isConnected
public boolean isConnected()
- Tells whether the connection is still alive.
send
public void send(LinkFrame frame) throws IOException
- experimental.
- Throws: IOException
- thrown if an error occured during the sending
of the frame
- See Also:
- sendBlindly
sendBlindly
public void sendBlindly(LinkFrame frame)
- experimental.
- See Also:
- send
receive
public LinkFrame receive() throws IOException, ClassNotFoundException
- experimental.
- Throws: ClassNotFoundException
- FATAL - the class corresponding
to the object read on the
ObjectInputStream
cannot
be found in the current JVM.
close
public void close()
- Close this
GameLink
link.
run
public void run()
- Run! Run! [DESCRIBE ME]
- Overrides:
- run in class Thread
addGameLinkListener
public synchronized void addGameLinkListener(GameLinkListener listener,
Object gameId)
- Adds the specified listener to the sets of listeners of this
GameLink
object. The listener will listen only to the messages related to the specified
game.
- Parameters:
- listener - the specified listener to be added.
- gameId - the id of the game of which the listener wants to get the messages.
deleteGameLinkListener
public synchronized void deleteGameLinkListener(GameLinkListener listener,
Object gameId)
- Removes the specified listener from the sets of listeners of this
GameLink
object for the given game id.
- Parameters:
- listener - the listener to be removed from the set.
- gameId - the id of the game set.
notifyListeners
void notifyListeners(LinkFrame frame)
- experimental.
All Packages Class Hierarchy This Package Previous Next Index