Prev | Current Page 830 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

tie(board.grid);
other.client.tie(board.grid);
TicTacToeServer.clear(this);
} else
other._turn();
} else
client.invalidMove();
}
public function attend() : Void
{
if(!TicTacToeServer.isAttendant(this))
TicTacToeServer.addAttendant(this);
}
}
The TicTacToeServer is the entry class on the server side. A ThreadRemotingServer is instantiated
in the main() method and wired to the initClientApi and clienDisconnected methods. The first
is triggered each time a new player connects to the server, the second when a player disconnects from
the server. The ThreadRemotingServer permits the simultaneous connection of many users. The
management of multiple connections is very efficient and only limited by the server hardware. The class
also manages the beginning and conclusion of each game session. Each time a new client connects and
the corresponding player has been added to the attendants list, the class creates a game session for each
couple of players.
import haxe.remoting.SocketConnection;
import neko.


Pages:
818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842