XsandOs RMI communication between server and client.

communication between server and client
Howto play:

X's and O's is a game were you need to win by having 3 in a row, could be diagonal, vertical or horizontal. You can only play 2 players each time and must connect at the same time to server sagittarius. Player 1 has X as his mark and Player 2 has O as his mark.

Howto and steps of creation of XsandOs and what the the files do:
1) Create an interface. (XOService.java).
2) Create a class that implements the interface. (XOServiceImpl.java).
3) Create a server that creates an instance of this class.
4) Create a client that connects to the server object using Naming.lookup() (XsandOs.java)
5) Compile these classes.
6) Run the RMI interface compiler on the .class file of the implementation
class ("rmic XOServiceImpl.java" rmic ).
7) Start the RMI registry on sagittarius ("/usr/java/jdk1.6.0_20/bin/rmiregistry 10000").
8) Start the server class ("java -ea XOServiceImpl") on sagittarius.
9) Download client.rar run the client bat program ("start_on_client.bat") this of course is that you have java SDK installed


start XOService on server sagittarius:


start XOService on sagittarius

Player 1 connects to sagittarius:


player1

Player 2 connects to sagittarius:


player2

Player 2 view after game has been ongoing:


player 2 view



Problems

Even if the java version is the same on both server sagittarius (Linux) and client computer (WinXP) there were some problem with the versionUID so had to put this line on:

static final long serialVersionUID = 4395065653687247141L;

sagittarius:/srv/www/htdocs/kth/i4/4_gesall # /usr/java/jdk1.6.0_20/bin/serialver XOBoard
XOBoard: static final long serialVersionUID = 4395065653687247141L;

check the RMI registry is started on port 10000 with Nagios:
sagittarius:/srv/www/htdocs/kth/i4/4_gesall # /usr/local/nagios/libexec/check_rmi localhost 10000 OK: Rmi-Server found at localhost:10000

EXTRA EDIT note:have lost password to my Speedtouch router/firewall so havent been able to open port 10000 to outside address (nat mapadd intf=Internet type=napt outside_addr) Dont want to lose other mappings but will see if i can find or hack the password :-)

Sourcecode:

Source code