Special thanks to user of geeeeeeek !
The original question was raised by geeeeeeek and it was answered by her/him later.
The original question was “Instead of localhost connection, can we connect IB gateway remotely?”
The answer is YES.
In RUN_ME.py, add remoteHostIP=’xx.xx.xx.xx’ (xx is your real remote host IP).
Also, you need to disable “localhost host connection only” option in your IB gateway first and then add trusted IP in the list before you do the remote connection.