0

27.10.2014:对于这个问题,我仍然非常需要帮助。ActionScript SmartFoxServer无法连接

我和朋友正试图通过SmartFoxServer托管游戏。他将服务器托管在他的计算机上,并已成功将必要的端口(9339)转发到他的本地IP。我们已经完成了this guide。根据SmartFoxServer通过管理面板和服务器终端窗口的反馈,托管应该是成功的。

但是,试图连接到他的公网IP的时候,我得到这个错误:

[WARN]安全错误:错误#2048:安全沙箱冲突:文件: 不能加载从#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文件

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"); 
} 

输出:

*试图启动并使用URL 目录文件 [SWF] 目录文件器连接到播放器 - 92561个字节解压后 [发送]: [WARN]安全错误:错误#2048:安全沙箱冲突:文件:目录中的文件可以不加载来自PUBLIC HOST IP:9339的数据。 [UnloadSWF] 目录的文件 调试会话终止。 调试会话终止。*

+0

您能否显示您的crossdomain.xml? – gabriel 2014-10-17 09:10:17

+0

完成。我还添加了配置文件和Flash文件。 – user3257755 2014-10-23 12:11:25

回答

0

我为了得到迅速帮助视为计算器最可靠的服务之一,但这次我从别的地方得到了答案。我会在这里重写它。

也许某个具有相同问题的人会认为这将在未来有用。

问题毕竟很简单。独立的Adobe Flash Player会自动拒绝这种连接。然而,它在浏览器中运行时会起作用。