Debugging Network Code
Debugging the network version of a game is a bit trickier than debugging other games. The network version of Reversi requires two instances of the game to be running: the client instance and the server instance. Visual Studio .NET will of course only let you debug one version of the program at a time, so you’ll have to decide which version you want to run in debug mode and which version to run straight from Windows. This usually depends on what part of the code you want to debug at the time. Say for the sake of example that you want to debug the server code; follow these steps:Compile the program.
Set desired breakpoints in the source.
Run the program from Visual Studio.
Select New Game, specify Network Game, and specify Wait for Someone to Connect to Me. Change the machine name or IP address (127.0.0.1 should always work if the client and server are running on the same machine).
Click OK.
Navigate to the project folder in Windows Explorer.
Go to the Bin directory.
Double-click the executable to run it. This will be the client instance.
Select New Game, specify Network Game, and specify Connect to Someone. Change the machine name or IP address if necessary.
Click OK.
Play the game. You’ll have to switch between the client and server boards to make your moves.
Your breakpoint in the server program should trigger normally.