{"id":303,"date":"2015-07-30T12:45:52","date_gmt":"2015-07-30T12:45:52","guid":{"rendered":"http:\/\/smartfoxserver.com\/blog\/?p=303"},"modified":"2015-07-30T12:46:01","modified_gmt":"2015-07-30T12:46:01","slug":"running-two-sfs2x-instances-on-the-same-machine","status":"publish","type":"post","link":"https:\/\/smartfoxserver.com\/blog\/running-two-sfs2x-instances-on-the-same-machine\/","title":{"rendered":"Running two SFS2X instances on the same machine"},"content":{"rendered":"<p>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.<\/p>\n<p><!--more--><\/p>\n<p>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.<\/p>\n<p>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&#8230; But not to worry, any operating system can handle up to 2^16 (65K)\u00a0TCP ports, so there is plenty of choice to avoid collisions.<\/p>\n<p>By default SmartFoxServer 2X binds two TCP ports when booting up:<\/p>\n<ul>\n<li>TCP 9933 for socket traffic<\/li>\n<li>TCP 8080 for HTTP traffic<\/li>\n<\/ul>\n<p>This is, of course, unless we customized the server configuration and\u00a0added other TCP or UDP ports, activated the WebSocket engine. Etc&#8230;<\/p>\n<p>For the sake of simplicity we will\u00a0just discuss\u00a0the default settings, but\u00a0the same principle\u00a0will apply if you need to use additional ports.<\/p>\n<h3>\u00bb Installing the first instance<\/h3>\n<p>We can start by downloading the <a title=\"Download SmartFoxServer 2X\" href=\"http:\/\/smartfoxserver.com\/download\/sfs2x#p=installer\" target=\"_blank\">SmartFoxServer 2X installer from here<\/a>, choosing the appropriate platform and architecture (32 vs 64 bit) and then proceed with the installation.<\/p>\n<p>If you need guidance with the installation and launch process for your operating system you can consult the <a title=\"Installing SFS2X\" href=\"http:\/\/docs2x.smartfoxserver.com\/GettingStarted\/installation\" target=\"_blank\">specific documentation<\/a>.<\/p>\n<p>Once SmartFoxServer is running we will access\u00a0the <strong>AdminTool<\/strong> by pointing the browser to this local address:\u00a0<strong>http:\/\/localhost:8080\/\u00a0<\/strong>and plugging in\u00a0the default credentials (sfsadmin \/ sfsadmin).<\/p>\n<p>We can now proceed to reconfigure the ports setting in order to avoid collisions with the second instance that we&#8217;re going to install in a moment.<\/p>\n<p>Let&#8217;s select the <strong>Server Configurator<\/strong> module from the left side bar, and edit the current TCP socket port from <strong>9933<\/strong> to something else, for instance: <strong>9934<\/strong><\/p>\n<p><a href=\"http:\/\/smartfoxserver.com\/blog\/wp-content\/uploads\/2015\/07\/ip-change.png\"><img loading=\"lazy\" class=\"aligncenter size-full wp-image-305\" src=\"http:\/\/smartfoxserver.com\/blog\/wp-content\/uploads\/2015\/07\/ip-change.png\" alt=\"ip-change\" width=\"733\" height=\"307\" srcset=\"https:\/\/smartfoxserver.com\/blog\/wp-content\/uploads\/2015\/07\/ip-change.png 733w, https:\/\/smartfoxserver.com\/blog\/wp-content\/uploads\/2015\/07\/ip-change-300x126.png 300w, https:\/\/smartfoxserver.com\/blog\/wp-content\/uploads\/2015\/07\/ip-change-624x261.png 624w\" sizes=\"(max-width: 733px) 100vw, 733px\" \/><\/a><\/p>\n<p>Next, let&#8217;s click the <strong>Web Server<\/strong> tab and edit the http port from <strong>8080<\/strong> to a new value, such as <strong>8081<\/strong><\/p>\n<p><a href=\"http:\/\/smartfoxserver.com\/blog\/wp-content\/uploads\/2015\/07\/http-change.png\"><img loading=\"lazy\" class=\"aligncenter size-full wp-image-306\" src=\"http:\/\/smartfoxserver.com\/blog\/wp-content\/uploads\/2015\/07\/http-change.png\" alt=\"http-change\" width=\"580\" height=\"318\" srcset=\"https:\/\/smartfoxserver.com\/blog\/wp-content\/uploads\/2015\/07\/http-change.png 580w, https:\/\/smartfoxserver.com\/blog\/wp-content\/uploads\/2015\/07\/http-change-300x164.png 300w\" sizes=\"(max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<div class=\"dottedYellowBox\"><strong>NOTE<\/strong>: the suggested new TCP port numbers are purely indicative. You can choose any other number as long as you&#8217;re sure no other service on your computer is using them. If you&#8217;re running a firewall you may need to set additional rules to allow proper communication for the new ports<\/div>\n<p>&nbsp;<\/p>\n<p>Now let&#8217;s click on the <strong>Remote Admin<\/strong>\u00a0tab and change the\u00a0Remote Admin port to match the first value we set, for our example this will port <strong>9934<\/strong>. This is important in order keep Access to the\u00a0AdminTool. If we leave the wrong value here we wouldn&#8217;t be able to connect as admins anymore.<\/p>\n<p><a href=\"http:\/\/smartfoxserver.com\/blog\/wp-content\/uploads\/2015\/07\/Schermata-2015-07-14-alle-12.40.56.png\"><img loading=\"lazy\" class=\"aligncenter size-full wp-image-311\" src=\"http:\/\/smartfoxserver.com\/blog\/wp-content\/uploads\/2015\/07\/Schermata-2015-07-14-alle-12.40.56.png\" alt=\"Schermata 2015-07-14 alle 12.40.56\" width=\"544\" height=\"338\" srcset=\"https:\/\/smartfoxserver.com\/blog\/wp-content\/uploads\/2015\/07\/Schermata-2015-07-14-alle-12.40.56.png 544w, https:\/\/smartfoxserver.com\/blog\/wp-content\/uploads\/2015\/07\/Schermata-2015-07-14-alle-12.40.56-300x186.png 300w\" sizes=\"(max-width: 544px) 100vw, 544px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>The final step is to\u00a0hit the <strong>Submit button<\/strong> at the bottom of the screen\u00a0and save the changes. Then we can safely restart SmartFoxServer 2X.<\/p>\n<h3>\u00bb Installing the second\u00a0instance<\/h3>\n<p>To check that everything is working correctly<\/p>\n<p>Now that we have re-configured the first SFS2X we can repeat the installation process a second time and start the new instance.<\/p>\n<p>In case you need to run a third (and so on&#8230;) 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.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[37,41,7],"_links":{"self":[{"href":"https:\/\/smartfoxserver.com\/blog\/wp-json\/wp\/v2\/posts\/303"}],"collection":[{"href":"https:\/\/smartfoxserver.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/smartfoxserver.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/smartfoxserver.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/smartfoxserver.com\/blog\/wp-json\/wp\/v2\/comments?post=303"}],"version-history":[{"count":6,"href":"https:\/\/smartfoxserver.com\/blog\/wp-json\/wp\/v2\/posts\/303\/revisions"}],"predecessor-version":[{"id":313,"href":"https:\/\/smartfoxserver.com\/blog\/wp-json\/wp\/v2\/posts\/303\/revisions\/313"}],"wp:attachment":[{"href":"https:\/\/smartfoxserver.com\/blog\/wp-json\/wp\/v2\/media?parent=303"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/smartfoxserver.com\/blog\/wp-json\/wp\/v2\/categories?post=303"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/smartfoxserver.com\/blog\/wp-json\/wp\/v2\/tags?post=303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}