Remote UCI engines and port forwarding

Discussion about chess-playing software (engines, hosts, opening books, platforms, etc...)

Remote UCI engines and port forwarding

Postby itias » Wed Aug 01, 2012 10:41 am

I'm looking for a piece of advice from someone who already got UCI engine working remotely by using port forwarding.
With help from netChess (http://home.arcor.de/bernhard.wallner/netChess.html) I'm able to use UCI engine over the LAN, but I wanted to do the same over the internet using port forwarding: remote machine behind NAT, home network NAT'ed too, but I have a 100% control over home network and I have linux host with ssh daemon I can use. Here is what I want to achieve:

remote Win machine R (running UCI engine)
|
(internet tunnel)
|
ssh host S
|
|
home laptop H (running Junior)

What I've tried is I launched UCI engine on R listening on port 7799, opened remote port 7799 on S and forwarded to local 7799 on R, so in theory anything in my home network connected to 7799 on S would actually talk to engine on R. Then I configured my H in the way that engineClient talks to S on port 7799 and tried to configure UCI engine in Junior - no luck :(
The whole tunneling concept works, as I was able to do the same with Remote Desktop (RDP protocol) configured the same way as above, of course different ports.
So my question is if anyone was able to do the same setup with netChess, or maybe some other, similar software?
itias
 
Posts: 7
Joined: Wed Aug 01, 2012 10:19 am

Re: Remote UCI engines and port forwarding

Postby AartBik » Wed Aug 01, 2012 7:21 pm

itias wrote:So my question is if anyone was able to do the same setup with netChess, or maybe some other, similar software?


Yes, I have experimented with this from an Android phone instead of a laptop, both from a LAN as well as externally over the internet with port forwarding.
See this connecting to a remote chess server posting and the followup post on temporary chess server (which is down now again).

Does your setup work in general, but just not within the Junior GUI? Did you try just using different clients? If you are willing to post your chess server IP address and port, I could test with Chess for Android as client.
User avatar
AartBik
 
Posts: 137
Joined: Tue Jun 15, 2010 9:39 pm
Location: Mountain View, CA

Re: Remote UCI engines and port forwarding

Postby itias » Wed Aug 01, 2012 8:31 pm

I will try different gui tomorrow but I think the problem may lie in remote port forwarding in opposite to the local port forwarding you used in your solution.
Please note that I'm opening remote port on my home router which is forwarded to the engine sitting on Windows computer in another location and my actual Junior GUI connects to my home router. The whole concept of using netChess works in a lan, but maybe there is something in its code that does not work well with remote port forward.
itias
 
Posts: 7
Joined: Wed Aug 01, 2012 10:19 am

Re: Remote UCI engines and port forwarding

Postby AartBik » Wed Aug 01, 2012 8:48 pm

itias wrote:The whole concept of using netChess works in a lan.


I have used netChess successfully for both settings, i.e. clients inside my LAN (always me :-)) connecting to the server as well as outside clients over the internet (including complete strangers) connecting to the same server. Port forwarding is only needed at the server side to bypass the firewall (you don't want strangers to access your server directly). I am not sure I understand why you seem to forward a port at the client side, but I probably misunderstand the question.
User avatar
AartBik
 
Posts: 137
Joined: Tue Jun 15, 2010 9:39 pm
Location: Mountain View, CA

Re: Remote UCI engines and port forwarding

Postby itias » Wed Aug 01, 2012 10:36 pm

There is a third scenario I try to solve here: UCI engine (the server) is also behind a firewall which I do not have a control of, so that is why I need to open a reverse tunnel to my ssh host first. So unlike your second scenario, I'm trying to connect to a more powerful machine sitting on the internet behind the firewall, but I cannot control that firewall. I will create a drawing tomorrow, I know that a picture speaks better than hundred words ;)
itias
 
Posts: 7
Joined: Wed Aug 01, 2012 10:19 am

Re: Remote UCI engines and port forwarding

Postby itias » Thu Aug 02, 2012 2:24 pm

Here is my drawing (you can click to enlarge):
uci.jpg
itias
 
Posts: 7
Joined: Wed Aug 01, 2012 10:19 am

Re: Remote UCI engines and port forwarding

Postby itias » Thu Aug 02, 2012 2:58 pm

Update: I've tried Arena GUI with no luck, too. Local port forward works, ie. installing UCI engine on laptop and connecting to it from office machine using Arena. But the configuration outlined on my drawing does not work :/
itias
 
Posts: 7
Joined: Wed Aug 01, 2012 10:19 am

Re: Remote UCI engines and port forwarding

Postby pokey909 » Sun Jun 02, 2013 9:42 pm

I know this thread is already a bit old, but I created a tool that works as a bridge between a UCI engine running on some remote machine (must be accessible via ssh) and any chess GUI.

Just modify the ini file to connect to your host, select the engine to be run remotely and create a new UCI engine in your gui that runs ChessBridge.exe insted of a real engine.

You can either compile it yourself or just download the prebuilt binary (x86/msvc2010 build).
Source + binaries can be downloaded here: https://bitbucket.org/pokey909/chessbridge/

Hope you find it useful. I'm currently running stockfish inside chessbase gui on a remote 12 core xeon with 40gb ram :-)

cheers!
pokey909
 
Posts: 2
Joined: Sun Jun 02, 2013 7:14 pm

Re: Remote UCI engines and port forwarding

Postby pokey909 » Mon Jun 03, 2013 11:20 pm

Seems like my last post didnt get through for some reason...
Even though this thread is already a bit old, it might be valuable for other people looking for a solution.

I coded a small tool that works as a kind of engine-proxy. It sits between an engine running on a remote machine and a GUI running on a local machine.
It works with any UCI capable GUI, including chessbase GUI.

Source and binaries can be downloaded here: https://bitbucket.org/pokey909/chessbridge

HOWTO:
- Download PuTTY and generate a keypair used for the ssh login on the remote machine. If you secure your key with a password, you have to start PuTTY's pageant.exe and add your key there since ChessBridge expects passwordless login.
- Now configure ChessBridge.ini to your needs. The file is quite self-explanatory. Just be sure to escape any backslashes with a backslash (e.g. c:\\some\\path)
- start you local gui and create a new UCI engine. Select ChessBridge.exe as your engine.
pokey909
 
Posts: 2
Joined: Sun Jun 02, 2013 7:14 pm

Re: Remote UCI engines and port forwarding

Postby H.G.Muller » Sun Sep 22, 2013 6:53 pm

I don't know if there is still any interest for this thread. I once tried Putty to run an engine remotely on a Windows machine. I could not get it to work, and the reason was that I could not figure out any way to switch off the echo. So the engine would echo all the GUI commands back, which the GUI did not like. (Under Linux I could use ssh, and it always worked like a charm.)

So when the problem came up again, I just wrote my own engine-GUI connection adapter, based on the p2p GUI-GUI connection adapter. It can act both as server and as client, depending on the arguments it gets in its startup command. If an engine is mentioned, it starts running as a server listening on the specified port, and each time someone makes a TCP/IP connection to that port it starts up the engine process through a pipe, (after exchanging a password to prevent abuse), and simply forwards everything the engine says to the network, and everything it receives from the network to the GUI. When started without an engine it creates a TCP/IP connection to the requested host and port, and forwards everything from the network to its standard output, while reading from its standard input, and sending everything it gets there to the network. (Basically acting as a sort of telnet.) So any GUI can simply run 'connect.exe' as an engine.

Of course you would have to map ports in modem and/or router on the server side to make sure that TCP/IP connections coming from the internet will reach the computer that you installed the server on.
H.G.Muller
 
Posts: 171
Joined: Sun Jul 14, 2013 10:00 am

Next

Return to Engines, GUIs, Books and Platforms

Who is online

Users browsing this forum: No registered users and 2 guests