Skip to content
ESB Docs

The Connection IP Guide

Last updated 3 min read

On this page

This guide will show you how to set up your bot to run on a machine that is separate from your instances running Bluestacks. The reason you would do this would be to conserve resources on the machine and improve responsiveness of the Bot. It’s generally recommended to run the bot on the same machine as Bluestacks because that’s a much simpler setup.


Procedure

  1. On the computer running Bluestacks, make note of the port your instance is running on. Settings > Advanced > Android Debug Bridge (ADB). The default port is usually 5555. You will see it’s running on 127.0.0.1:5555.

  2. Repeat this for each instance you are running.

  3. Now, open a command prompt as admin.

  4. Type ipconfig

  5. Make note of the IPv4 Address. In this case 192.168.4.160

    [!TIP] It will be helpful to have a static IP address for this to be reliable long term.

  6. Next, we are going to forward the same port 5555 from the IP address of your computer to the IP address that Bluestacks is listening on.

  7. First, Bluestacks must be running before you run the command below, otherwise the forwarding rules will be made but not actually work.

  8. Type the following:

    netsh interface portproxy add v4tov4 listenaddress=192.168.4.160 listenport=5555 connectaddress=127.0.0.1 connectport=5555
    
  9. Repeat this for the additional ports noted in Step 2. You’ll change 5555 to represents those ports. Everything else will stay the same. Again, make sure each Bluestacks instance is running first.

  10. Next, you will need to ensure your firewall allows the ports for each instance through.

  11. Click Start and Search for Windows Firewall with Advanced Security

    1. Create a new Inbound Rule
    2. Select Port
    3. Select TCP, then fill in a comma separated port list. 5555, 5565 in the below example. If you only have one instance, you’ll only have one port.
    4. Click Next through the remaining dialog boxes, give it a name, and then click Finish.
  12. Now, on the computer where you wish to run the bot, launch the bot.

  13. Go to the Admin Tab and set the Connection IP: field to match what you learned in step 5 above.

  14. Configure your emulator port for each Bluestack instance.

  15. Start your tabs

Restarting

Upon restarting anything such as Bluestacks or your computer(s), you’ll need to clean up the port forwarding rules first. Again, Bluestacks must be running for the rules to work.

  1. Open your admin command prompt.

  2. Type netsh interface portproxy show all to see your rules.

  3. Type the following to delete the rule for port 5555

    netsh interface portproxy delete v4tov4 listenaddress=192.168.4.160 listenport=5555
    
  4. Repeat for each rule you made but modify the line appropriately.

  5. Start Bluestacks

  6. Re-Create your port forwarding rules as described in step 8 above.

  7. Start your bots on the 2nd PC

Script Sample

The below script is something you can take and modify to match your situation. This will streamline things for you between restarts. Copy and Paste it into Notepad and modify appropriately. Save to your desktop as a .cmd or .bat file. Run as administrator.

ECHO "Rules we have created"
netsh interface portproxy show all
ECHO "Delete our Rules"
netsh interface portproxy delete v4tov4 listenaddress=192.168.4.160 listenport=5555
netsh interface portproxy delete v4tov4 listenaddress=192.168.4.160 listenport=5565
netsh interface portproxy delete v4tov4 listenaddress=192.168.4.160 listenport=5575
netsh interface portproxy delete v4tov4 listenaddress=192.168.4.160 listenport=5585
netsh interface portproxy delete v4tov4 listenaddress=192.168.4.160 listenport=5595
netsh interface portproxy delete v4tov4 listenaddress=192.168.4.160 listenport=5605
netsh interface portproxy show all
ECHO "Re-Create Rules"
netsh interface portproxy add v4tov4 listenaddress=192.168.4.160 listenport=5555 connectaddress=127.0.0.1 connectport=5555
netsh interface portproxy add v4tov4 listenaddress=192.168.4.160 listenport=5565 connectaddress=127.0.0.1 connectport=5565
netsh interface portproxy add v4tov4 listenaddress=192.168.4.160 listenport=5575 connectaddress=127.0.0.1 connectport=5575
netsh interface portproxy add v4tov4 listenaddress=192.168.4.160 listenport=5585 connectaddress=127.0.0.1 connectport=5585
netsh interface portproxy add v4tov4 listenaddress=192.168.4.160 listenport=5595 connectaddress=127.0.0.1 connectport=5595
netsh interface portproxy add v4tov4 listenaddress=192.168.4.160 listenport=5605 connectaddress=127.0.0.1 connectport=5605
netsh interface portproxy show all
timeout 5

Note

Credits to GeneralMaximus#5181 for making this guide