Running two SFS2X instances on the same machine

Every once in a while we receive a support request asking if it is possible to run multiple instances of SFS2X on the same PC. In this recipe we will guide you through a few simple steps to perform a multi instance setup.

The principal issue with running multiple copies of SFS2X on the same machine is that they need to be configured to use different TCP ports, otherwise they will fail to start up.

The reason for this is that a TCP port can only be used by one process in the system, so any other software attempting to bind an already used port will fail with an error… But not to worry, any operating system can handle up to 2^16 (65K) TCP ports, so there is plenty of choice to avoid collisions.

By default SmartFoxServer 2X binds two TCP ports when booting up:

  • TCP 9933 for socket traffic
  • TCP 8080 for HTTP traffic

This is, of course, unless we customized the server configuration and added other TCP or UDP ports, activated the WebSocket engine. Etc…

For the sake of simplicity we will just discuss the default settings, but the same principle will apply if you need to use additional ports.

» Installing the first instance

We can start by downloading the SmartFoxServer 2X installer from here, choosing the appropriate platform and architecture (32 vs 64 bit) and then proceed with the installation.

If you need guidance with the installation and launch process for your operating system you can consult the specific documentation.

Once SmartFoxServer is running we will access the AdminTool by pointing the browser to this local address: http://localhost:8080/ and plugging in the default credentials (sfsadmin / sfsadmin).

We can now proceed to reconfigure the ports setting in order to avoid collisions with the second instance that we’re going to install in a moment.

Let’s select the Server Configurator module from the left side bar, and edit the current TCP socket port from 9933 to something else, for instance: 9934


Next, let’s click the Web Server tab and edit the http port from 8080 to a new value, such as 8081


NOTE: the suggested new TCP port numbers are purely indicative. You can choose any other number as long as you’re sure no other service on your computer is using them. If you’re running a firewall you may need to set additional rules to allow proper communication for the new ports


Now let’s click on the Remote Admin tab and change the Remote Admin port to match the first value we set, for our example this will port 9934. This is important in order keep Access to the AdminTool. If we leave the wrong value here we wouldn’t be able to connect as admins anymore.

Schermata 2015-07-14 alle 12.40.56


The final step is to hit the Submit button at the bottom of the screen and save the changes. Then we can safely restart SmartFoxServer 2X.

» Installing the second instance

To check that everything is working correctly

Now that we have re-configured the first SFS2X we can repeat the installation process a second time and start the new instance.

In case you need to run a third (and so on…) instance you can repeat the process of reconfiguring the ports every time after the installation process. This will guarantee that each SFS2X is running with different TCP ports and no collisions will happen.