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!