Saturday, March 31, 2012

Connecting Chess for Android to a Remote Server

I have received several questions on how to connect Chess for Android running on an Android device (e.g. a phone) as client to a remote chess server (e.g. a powerful desktop), so I decided to write a small document with detailed instructions.

What you will need:
  • The server software from Bernhard Wallner's chess utilities, suited for your server's operating system (if, say, your desktop runs Windows, you will need to download the Windows version). You do not need to download the client software in this case.
  • The network enabled version of Chess for Android.
On the server, start the engine server software, and construct a new row for every engine you want to run remotely. Assign a name, port number, and select the full path to each engine binary (an executable that runs on the server). You can also supply command line options for starting the engine. Check the active checkboxes and click start when done. This yields something similar to the screenshots below. Here, I have started BikJump on port 1048 and Stockfish on port 1049.

Next, you will have to find the IP address of your server. You can find this, for example, using the ipconfig utility. On a local network, you can also query the router for the IP addresses assigned to different computers. Note that running a globally accessible server behind a firewall requires a setup that is a bit outside the scope of this posting (for example, you may need DDNS if your IP address is assigned dynamically, and you may need to forward ports to your chess server in a router).

On the Android device, which will be your client, start Chess for Android, long press the notation window and then select "UCI and XBoard", followed by "Import Engine", followed by "Network Socket". In the pop-up window, enter the IP address or domain name in Hostname box, and the appropriate port in the Port box. Make sure you also make the correct UCI or XBoard selection. In the example below, my server was running on IP address and I want to connect to stockfish on port 1049. If all has been done well, this pops up the engine setup window. Select the desired parameters (note that the endgame tablebases path name applies to your server, not the Android device) and press done.

That's it! In the screenshots below, you see stockfish running remotely at about 867 KNs. In contrast, a screenshot with stockfish running as native ARM binary on the device is shown as well, running at about 67 KNs.