23.8. Client/Server Tic-Tac-Toe Using a Multithreaded Server
We now present a networked version of the popular game Tic-Tac-Toe, implemented with stream sockets and client/server techniques. The program consists of a FrmTicTac-ToeServer application (Fig. 23.5) and a FrmTicTacToeClient application (Fig. 23.6). The FrmTicTacToeServer allows two FrmTicTacToeClients to connect to the server and play Tic-Tac-Toe against each other. Sample outputs appear in Fig. 23.6. When the server receives a client connection, lines 70–79 of Fig. 23.5 create instances of class Player to process each client in a separate thread of execution. This enables the server to handle requests from both clients. The server assigns value "X" to the first client that connects ...
Get Visual Basic 2005 for Programmers: Deitel Developer Series, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.