27.10.2014: I still really need help for this question.
My friend and I are trying to host a game through SmartFoxServer. He is hosting the server on his computer, and has successfully portforwarded the necessary port (9339) to his local IP. We have done everything in this guide. According to SmartFoxServer's feedback through the admin panel and the server terminal window, the hosting should be successful.
However, when trying to connect to his public IP, I get this error:
[WARN] Security Error: Error #2048: Security sandbox violation: file: cannot load data from #IP#.
crossdomain.xml
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" t-ports="*" secure="false" />
</cross-domain-policy>
config.xml
<ServerSetup>
<ServerIP>10.0.0.8</ServerIP>
<ServerPort>9339</ServerPort>
<AutoSendPolicyFile>true</AutoSendPolicyFile>
<MaxUserIdleTime>300</MaxUserIdleTime>
<!-- Server Variables limits (-1 = unlimited) -->
<MaxRoomVars>-1</MaxRoomVars>
<MaxUserVars>-1</MaxUserVars>
<AntiFlood active="false">
<MinMsgTime tolerance="5">1000</MinMsgTime>
<MaxRepeatedMessages>3</MaxRepeatedMessages>
<WarningsBeforeKick>2</WarningsBeforeKick>
<WarningMessage><![CDATA[No flooding allowed!)]]></WarningMessage>
<KickMessage><![CDATA[You've been warned! No flooding! Now you're kicked]]></KickMessage>
<BanMessage><![CDATA[Stop Flooding!! You're being banned]]></BanMessage>
<BanAfter timeSpan="1">3</BanAfter>
</AntiFlood>
<BadWordsFilter active="false">
<FilterMode>filter</FilterMode> <!-- REMOVE or FILTER -->
<StripCharacters><![CDATA[,.;:_!$%&/#*-+]]></StripCharacters>
<Warnings>true</Warnings>
<FilterRoomNames>true</FilterRoomNames>
<FilterUserNames>true</FilterUserNames>
<WarningsBeforeKick>3</WarningsBeforeKick>
<WarningMessage><![CDATA[No swearing!)]]></WarningMessage>
<KickMessage><![CDATA[You've been warned! No Swearing! Now you're kicked]]></KickMessage>
<BanMessage><![CDATA[Stop Swearing! You're being banned!]]></BanMessage>
<BanAfter timeSpan="1">3</BanAfter>
<BadWordsList>
<badWord>motherfucker</badWord>
<badWord>dickhead</badWord>
<badWord>asshole</badWord>
<badWord>shithead</badWord>
<badWord>shit</badWord>
<badWord>fucking</badWord>
<badWord>fuck</badWord>
<badWord>dickhead</badWord>
<badWord>bastard</badWord>
<badWord>nigger</badWord>
<badWord>idiot</badWord>
<badWord>bitch</badWord>
</BadWordsList>
</BadWordsFilter>
<BanCleaning>auto</BanCleaning>
<BanDuration>1800</BanDuration> <!-- 30 min -->
<BannedLoginMessage>You have been banned!</BannedLoginMessage>
<OutQueueThreads>1</OutQueueThreads>
<ExtHandlerThreads>1</ExtHandlerThreads>
<MaxWriterQueue>50</MaxWriterQueue>
<MaxIncomingQueue>8000</MaxIncomingQueue>
<DeadChannelsPolicy>strict</DeadChannelsPolicy>
<MaxMsgLen>4096</MaxMsgLen>
<LogMaxSize>5000000</LogMaxSize>
<LogMaxFiles>5</LogMaxFiles>
<!--
Available options are:
FINEST
FINER
FINE
CONFIG
INFO
WARNING
SEVERE
-->
<FileLoggingLevel>WARNING</FileLoggingLevel>
<ConsoleLoggingLevel>INFO</ConsoleLoggingLevel>
<AdminLogin>sfs_admin</AdminLogin>
<AdminPassword>sfs_pass</AdminPassword>
<AdminAllowedAddresses>
<AllowedAddress>*.*.*.*</AllowedAddress>
</AdminAllowedAddresses>
<IpFilter>0</IpFilter>
<!-- Enable / Disable remote zone info -->
<EnableZoneInfo>false</EnableZoneInfo>
</ServerSetup>
<!--
Zones Configuration.
-->
<Zones>
<Zone name="multiChat">
<Rooms>
<Room name="Main Lobby" maxUsers="50" isPrivate="false" isTemp="false" autoJoin="true" />
</Rooms>
</Zone>
</Zones>
Actionscript 3 / Flash File
import flash.events.SecurityErrorEvent;
import flash.system.Security;
import it.gotoandplay.smartfoxserver.*
import flash.events.MouseEvent;
connect_btn.addEventListener(MouseEvent.CLICK, initiateConnection);
function initiateConnection(evt:MouseEvent):void
{
// ip_text.test = public IP address of server host machine
// int(port_text.text) = 9339
// zone_text.text = "multiChat"
// name_text.text = "testUser"
status_text.text = "Connecting to " + ip_text.text + "...";
var policyLoad:String = "xmlsocket://" + ip_text.text + ":" + port_text.text;
Security.loadPolicyFile(policyLoad)
var smartFox:SmartFoxClient = new SmartFoxClient(true)
smartFox.addEventListener(SecurityErrorEvent.SECURITY_ERROR, sandboxHandler)
smartFox.addEventListener(SFSEvent.onConnection, onConnectionHandler)
smartFox.connect(ip_text.text, int(port_text.text))
smartFox.addEventListener(SFSEvent.onLogin, onLoginHandler)
smartFox.addEventListener(SFSEvent.onRoomListUpdate, onRoomListUpdateHandler)
smartFox.login(zone_text.text, name_text.text, "")
}
function onConnectionHandler(evt:SFSEvent):void
{
if (evt.params.success)
status_text.appendText("Connection successful \n");
else
status_text.appendText("Connection failed \n");
}
function onLoginHandler(evt:SFSEvent):void
{
if (evt.params.success)
status_text.appendText("Successfully logged in as " + evt.params.name + "\n");
else
status_text.appendText(status_text.text + "Zone login error; the following error occurred: " + evt.params.error + "\n");
}
function onRoomListUpdateHandler(evt:SFSEvent):void
{
// Dump the names of the available rooms in the "simpleChat" zone
for (var r:String in evt.params.roomList)
status_text.appendText(status_text.text + evt.params.roomList[r].getName() + "\n");
//smartFox.joinRoom(10)
}
function sandboxHandler(evt:SecurityErrorEvent):void
{
status_text.appendText("Sandbox Error / Flash Security Error Event");
}
Output:
*Attempting to launch and connect to Player using URL DIRECTORY OF FILE [SWF] DIRECTORY OF FILE - 92561 bytes after decompression [Sending]: [WARN] Security Error: Error #2048: Security sandbox violation: file:DIRECTORY OF FILE cannot load data from PUBLIC HOST IP:9339. [UnloadSWF] DIRECTORY OF FILE Debug session terminated. Debug session terminated.*