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]


Variable Index

 o connected
 o debug
if true, enables the printing of debug informations on the console.
 o is
 o listeners
 o os
 o socket
The socket used for the link.

Constructor Index

 o GameLink(Socket)
Creates a new GameLink, wrapping around the given Socket.

Method Index

 o addGameLinkListener(GameLinkListener, Object)
Adds the specified listener to the sets of listeners of this GameLink object.
 o close()
Close this GameLink link.
 o deleteGameLinkListener(GameLinkListener, Object)
Removes the specified listener from the sets of listeners of this GameLink object for the given game id.
 o isConnected()
Tells whether the connection is still alive.
 o notifyListeners(LinkFrame)
experimental.
 o receive()
experimental.
 o run()
Run! Run! [DESCRIBE ME]
 o send(LinkFrame)
experimental.
 o sendBlindly(LinkFrame)
experimental.

Variables

 o socket
 Socket socket
The socket used for the link.

 o is
 InputStream is
 o os
 OutputStream os
 o debug
 boolean debug
if true, enables the printing of debug informations on the console.

 o listeners
 Hashtable listeners
 o connected
 boolean connected

Constructors

 o 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.

Methods

 o isConnected
 public boolean isConnected()
Tells whether the connection is still alive.

 o 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
 o sendBlindly
 public void sendBlindly(LinkFrame frame)
experimental.

See Also:
send
 o 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.
 o close
 public void close()
Close this GameLink link.

 o run
 public void run()
Run! Run! [DESCRIBE ME]

Overrides:
run in class Thread
 o 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.
 o 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.
 o notifyListeners
 void notifyListeners(LinkFrame frame)
experimental.


All Packages  Class Hierarchy  This Package  Previous  Next  Index