Unable to reach server: *** Security Sandbox Violation ***

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

Nigey
Posts: 35
Joined: 17 Dec 2014, 21:55

Unable to reach server: *** Security Sandbox Violation ***

Postby Nigey » 25 Jan 2015, 14:23

Hi guys,

I've recently taken over a project, which was working successfully. I've been working on it about 3 months, all working okay. I've only just started changing some of the server information, like the config.xml and the OpenSpace Maps. The game is now not connecting to the SmartFoxServer. I can't find what the issue is.

Here is my code:

SFSEventHandlers.as3

Code: Select all

      public function SFSEventHandlers() {

         global.serverIPAddress = "92.222.221.175";
         gGameObj=global;
         MainObj=global.CaviaMapViewer;
            
               //MainObj.connection_status_text.text = "Initializing Server Connection...";
               var smartfox:SmartFoxClient = new SmartFoxClient();

               global.smartFox = smartfox;
               smartFox = smartfox;
               
                // Add event handler for connection
                   smartFox.addEventListener(SFSEvent.onConnection, onConnectionHandler)
               smartFox.addEventListener(SFSEvent.onLogin, onLoginHandler)
               smartFox.addEventListener(SFSEvent.onJoinRoom, onJoinRoomHandler)                  
               smartFox.addEventListener(SFSEvent.onExtensionResponse, onExtensionResponseHandler)                        
//               smartFox.addEventListener(SFSEvent.onJoinRoomError, onJoinRoomErrorHandler)
               smartFox.addEventListener(SFSEvent.onRoomListUpdate, onRoomListUpdateHandler)
               smartFox.addEventListener(SFSEvent.onUserLeaveRoom, onUserLeaveRoomHandler)   
               smartFox.addEventListener(SFSEvent.onConnectionLost, onConnectionLostHandler)            
               smartFox.addEventListener(SFSEvent.onAdminMessage, onAdminMessageHandler)               
               smartFox.addEventListener(SFSEvent.onRandomKey, onRandomKeyHandler)
               smartFox.addEventListener(SFSEvent.onRoundTripResponse, onRoundTripResponseHandler)
               smartFox.addEventListener(SFSEvent.onPublicMessage, onPublicMessageHandler)
               
               smartFox.connect(global.serverIPAddress, 9339) //9339
               trace(smartFox + " Connecting")
               MainObj.connection_status_text.text = "Connecting...";

         trace("SmartFox Event Handlers Initialized");

      }

       // Handle connection event
       public function onConnectionHandler(evt:SFSEvent):void
       {
           if (evt.params.success) {
            
             smartFox.getRandomKey()
         
               trace("Great, successfully connected! " + smartFox)
            MainObj.connection_status_text.text = "Connection Successful...";         
         }
           else {
               trace("Connection failed!")
         }
       } // onConnectionHandler function
      


Code: Select all

<SmartFoxConfig>
   
   <ServerSetup>
      <!--
         Specify an ip address or use an asterisk(*) to bind all available IPs
      -->
      <ServerIP>*</ServerIP>
      <ServerPort>9339</ServerPort>
      
      <AutoSendPolicyFile>true</AutoSendPolicyFile>
      <MaxUserIdleTime>3600</MaxUserIdleTime>
      <MaxSocketIdleTime>3600</MaxSocketIdleTime>
      
      <!-- Server Variables limits (-1 = unlimited) -->
      <MaxRoomVars>-1</MaxRoomVars>
      <MaxUserVars>-1</MaxUserVars>
      
      <!-- New since 1.6.3, optimizes user variables size -->
      <UserVarsOptimization>true</UserVarsOptimization>
      <FileLoggingLevel>FINE</FileLoggingLevel>
      <ConsoleLoggingLevel>FINE</ConsoleLoggingLevel>   
      
      <!-- Adminisitrator login -->
      <AdminLogin>sfs_game</AdminLogin>
      <AdminPassword>sfsadmin</AdminPassword>
      
      <!-- Allowed administrator IP addresses -->
      <AdminAllowedAddresses>
         <AllowedAddress>*.*.*.*</AllowedAddress>
      </AdminAllowedAddresses>
      
      <!-- Allow remote debugging of extensions -->
      <ExtensionRemoteDebug>true</ExtensionRemoteDebug>
</SmartFoxConfig>


That isn't the entire config file, but it's pretty large so I decided to curb some of the details there. Basically it was working fine, however I've made some minor changes (can't remember exact changes), and now the game is throwing up this in the Flash Remote Debugger:

Code: Select all

[SWF] /game_site/CaviaMapViewer.swf - 2468026 bytes after decompression
[object SmartFoxClient] Connecting
SmartFox Event Handlers Initialized
Success Loading MapViewer Module
[SWF] /game_site/assets/media/avatar/avatar_container.swf - 205983 bytes after decompression
Avatars external library loaded via SWFLoader
Error: Request for resource at xmlsocket://92.222.221.175:9339 by requestor from http://www.examplewebsitess.co.uk/game_site/CaviaGame.swf has failed because the server cannot be reached.

*** Security Sandbox Violation ***
Connection to 92.222.221.175:9339 halted - not permitted from http://www.examplewebsitess.co.uk/game_site/CaviaGame.swf
[ Send ]: sfsHttp=connect
Warning: Failed to load policy file from http://92.222.221.175:8080/crossdomain.xml

*** Security Sandbox Violation ***
Connection to http://92.222.221.175:8080/BlueBox/HttpBox.do halted - not permitted from http://www.examplewebsitess.co.uk/game_site/CaviaGame.swf
Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: http://www.examplewebsitess.co.uk/game_site/CaviaGame.swf cannot load data from http://92.222.221.175:8080/BlueBox/HttpBox.do.
   at it.gotoandplay.smartfoxserver.http::LoaderFactory()[C:\Users\Nigel\Dropbox\Game Projects\Development\Flash src\dev\com\it\gotoandplay\smartfoxserver\http\LoaderFactory.as:32]
   at it.gotoandplay.smartfoxserver.http::HttpConnection()[C:\Users\Nigel\Dropbox\Game Projects\Development\Flash src\dev\com\it\gotoandplay\smartfoxserver\http\HttpConnection.as:47]
   at it.gotoandplay.smartfoxserver::SmartFoxClient()[C:\Users\Nigel\Dropbox\Game Projects\Development\Flash src\dev\com\it\gotoandplay\smartfoxserver\SmartFoxClient.as:607]
   at com.cavia.smartfox::SFSEventHandlers()[C:\Users\Nigel\Dropbox\Game Projects\Development\Flash src\dev\com\cavia\smartfox\SFSEventHandlers.as:34]
   at com.cavia::CaviaMapViewer/initSmartFox()[C:\Users\Nigel\Dropbox\Game Projects\Development\Flash src\dev\com\cavia\CaviaMapViewer.as:163]
   at com.cavia::CaviaMapViewer/initMapViewer()[C:\Users\Nigel\Dropbox\Game Projects\Development\Flash src\dev\com\cavia\CaviaMapViewer.as:153]
   at com.cavia::CaviaMapViewer()[C:\Users\Nigel\Dropbox\Game Projects\Development\Flash src\dev\com\cavia\CaviaMapViewer.as:80]
Error: Request for resource at http://92.222.221.175:8080/BlueBox/HttpBox.do by requestor from http://www.examplewebsitess.co.uk/game_site/CaviaGame.swf is denied due to lack of policy file permissions.

Debug session terminated.



I'm used to Flash in general, however I'm new to the SmartFoxServer, and I'm not totally sure what's happening. Can anyone advise? Thanks!
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Unable to reach server: *** Security Sandbox Violation *

Postby Lapo » 26 Jan 2015, 12:54

Hello.
1) You are working with SFS PRO, so this is the wrong forum section (SFS2X). No prob, I have moved the post

2) I noticed you are creating SmartFoxClient as a local variable inside a function. That's a problem, because the variable looses scope as soon as you leave the function, although the event listeners are still pointing to it. You may want to fix that.

3) Re: the connection problem, are you sure SmartFoxServer is running at the IP address you're using?
I ask because nor port 9339 neither 8080 are open. If the server is running then a firewall is likely to be blocking all communications on those two TCP ports.

hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
Nigey
Posts: 35
Joined: 17 Dec 2014, 21:55

Re: Unable to reach server: *** Security Sandbox Violation *

Postby Nigey » 27 Jan 2015, 10:28

Hi Lupo,

Thanks for replying to me. I'm fairly new to SmartFoxServer. How would I check whether SmartFoxServer is running at the IP address? It was previously working totally fine. Now I can't login using the details via the administration tools and the game no longer plays as usual.

Regards,
Nige
Nigey
Posts: 35
Joined: 17 Dec 2014, 21:55

Re: Unable to reach server: *** Security Sandbox Violation *

Postby Nigey » 28 Jan 2015, 13:16

I've been looking at SmartFoxServer setup. Considering every other aspect of the website and the game's core functionality works correctly, is there any other way (asides deleting or modifying some files) a server, which was previously running, can stop working? The only thing I can remember doing is trying to sign in to the admin tools for my server. By doing that with this different computer to the previous, could I somehow reset some server settings or something or reset a firewall? From the looks of the history of the files I have on my hosted site, none have been modified, asides OpenSpace map files. I can't confirm no files haven't been deleted or moved by accident. Is there a way to check against a working server setup for the exact required files or something? Or atleast the core ones?

Due to me being completely green with sfs I'm trying look at the issue from every angle and eliminate the possibility of each one until I find the correct problem.

Does anyone have any suggestions?

Thanks in advance!
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Unable to reach server: *** Security Sandbox Violation *

Postby Lapo » 29 Jan 2015, 16:30

In order to check if SmartFoxServer is running you should check your active processes in your OS.
If it's Windows use the TaskManager, if it's Linux you can use "top" or "ps" in a terminal.

Also you should consult the logs to see if there's any error at startup that might be causing the server not to run. I would recommend to consult the section 3 of the documentation here: http://www.smartfoxserver.com/docs/1x/

Once the server is running, you can try to connect via the AdminTool. If it works there's no firewall problem. If it doesn't you should check your FW settings.

Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games
Nigey
Posts: 35
Joined: 17 Dec 2014, 21:55

Re: Unable to reach server: *** Security Sandbox Violation *

Postby Nigey » 30 Jan 2015, 00:50

That's amazing help, thanks Lapo! I'll try that asap!

One question. The server is actually held on a Plesk hosting site, not my own computer. Will this change any of your recommendations?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Unable to reach server: *** Security Sandbox Violation *

Postby Lapo » 30 Jan 2015, 09:52

Nope :)
Lapo

--

gotoAndPlay()

...addicted to flash games
Nigey
Posts: 35
Joined: 17 Dec 2014, 21:55

Re: Unable to reach server: *** Security Sandbox Violation *

Postby Nigey » 02 Feb 2015, 16:06

Okay there are no active processes for SmartFoxServer that I can see in the TaskManager. If I use 'start.bat' it says the server is connected and working. Neither the 127.0.0.1 or the actual IP for our project is working. So I am assuming this means it's an issue with the SmartFoxServer Pro setup?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Unable to reach server: *** Security Sandbox Violation *

Postby Lapo » 02 Feb 2015, 17:25

You can't even connect locally to 127.0.0.1 using the AdminTool?

What if you do a

Code: Select all

telnet 127.0.0.1 9339

?

You should see the server sending back the Flash crossdomain policy.

If that doesn't happen check your OS firewall settings. Chances are it is blocking every communiction and you should add a rule for TCP port 9339.
Lapo

--

gotoAndPlay()

...addicted to flash games
Nigey
Posts: 35
Joined: 17 Dec 2014, 21:55

Re: Unable to reach server: *** Security Sandbox Violation *

Postby Nigey » 03 Feb 2015, 16:50

Nope not at all. Just tried that. Response for trying the telnet 127.0.0.1 9339 was:

"Connecting To 127.0.0.1...Could not open connection to the host, on port 9339: Connect failed"

The issue is that I've just gone to my firewall settings (Windows 8.1), and I've opened the port 9339 in it's advanced settings as a TCP Port, like this: http://windows.microsoft.com/en-gb/windows/open-port-windows-firewall#1TC=windows-7. It's set as public to all users. I'm administrator anyway, but I thought I'd go the full hog. That still doesn't let it open.. ?
Nigey
Posts: 35
Joined: 17 Dec 2014, 21:55

Re: Unable to reach server: *** Security Sandbox Violation *

Postby Nigey » 03 Feb 2015, 19:36

Okay now I now have the local server working. That now works okay. I've done start.bat and used the AdminTools.swf and used that for the local version. That's now running. However the server I actually need still isn't. Advice?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Unable to reach server: *** Security Sandbox Violation *

Postby Lapo » 05 Feb 2015, 09:32

You mean you have another server with SFS with the same problem? i.e. can't connect?
If so, is it running the same OS?
If yes, did you setup the firewall in the same way?

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
Nigey
Posts: 35
Joined: 17 Dec 2014, 21:55

Re: Unable to reach server: *** Security Sandbox Violation *

Postby Nigey » 05 Feb 2015, 13:24

Hi Lapo,

Since the last post I've made some progress. However I'm still having an issue with getting the game to work. Basically the setup is I have the SFS Pro embedded within a webpage server. I've figured out now how to start and stop the server (using the Terminal on my Mac, and trying "./sfs2x-service start". However when I do this the entire webpage stops running completely. I've contacted the support for the hosted site the SFS is put in. They've informed me every port in the webpage works, apart from Port 80, which is apparently the most important one for the webpage to be running. Can you theorise any conflictions SFS may have within a webpage and how to counter-act this? Or another way to setup, or start the server?

Many Thanks,
Nigel
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Unable to reach server: *** Security Sandbox Violation *

Postby Lapo » 05 Feb 2015, 17:31

Nigey wrote:Hi Lapo,

Since the last post I've made some progress. However I'm still having an issue with getting the game to work. Basically the setup is I have the SFS Pro embedded within a webpage server.

Ouch... this may not be a good idea.
Please make sure that none of the installation files are located in a public web folder. If you do that your installation will be exposed to the entire web!

SmartFoxServer is a standalone server and as such has nothing to do with any other HTTP servers. It must be installed in its own separate folder.

I've figured out now how to start and stop the server (using the Terminal on my Mac, and trying "./sfs2x-service start". However when I do this the entire webpage stops running completely. I've contacted the support for the hosted site the SFS is put in. They've informed me every port in the webpage works, apart from Port 80, which is apparently the most important one for the webpage to be running. Can you theorise any conflictions SFS may have within a webpage and how to counter-act this? Or another way to setup, or start the server?


No. SmartFoxServer by default uses port 9933 for sockets and port 8080 for HTTP, but you can turn off the embedded HTTP server if you don't need it and in any case it won't affect port 80.

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
Nigey
Posts: 35
Joined: 17 Dec 2014, 21:55

Re: Unable to reach server: *** Security Sandbox Violation *

Postby Nigey » 06 Feb 2015, 18:50

Hiya Lupo,

It's in it's own folder outside of the website folder, that's all okay. I'm just trying to start the SmartFoxServer using ./sfs start. It's coming up with this error:

Code: Select all

Starting SmartFoxServer PRO...
rm: cannot remove `/var/www/vhosts/vps93938.ovh.net/fashionsplash.co.uk/gameserver/SFS_PRO_1.6.6/Server/runAsService//SmartFoxServer.pid': Permission denied
Removed stale pid file: /var/www/vhosts/vps93938.ovh.net/fashionsplash.co.uk/gameserver/SFS_PRO_1.6.6/Server/runAsService//SmartFoxServer.pid
-bash-4.1$ ^C


I'm guessing I'm doing something pretty basic wrong. Any ideas?

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 36 guests