簡體   English   中英

無法使Java Flash策略服務器正常工作

[英]Trouble getting Java flash policy server work

我正在嘗試為Flash創建游戲服務器,但仍在嘗試將策略文件從Java服務器發送到Flash游戲。

服務器收到消息

<policy-file-request/>\0

同樣,但是無法將xml返回游戲。

這是獲取和返回消息時我的游戲服務器代碼

    if (message.equals("<policy-file-request/>" + '\0')) {
        StringBuffer policyBuffer = new StringBuffer();
        policyBuffer.append("<?xml version=\"1.0\"?><cross-domain-policy>");
        policyBuffer.append("<allow-access-from domain=\"*\" to-ports=\"*\" />");
        policyBuffer.append("</cross-domain-policy>");
        String returnPolicy = policyBuffer.toString() + '\0';
        //byte[] returnPolicyBytes = returnPolicy.getBytes();
        System.out.println("Returning cross-domain-policy...\n" + returnPolicy);
        //packet.socket.getOutputStream().write(returnPolicyBytes, 0, returnPolicyBytes.length);
        //packet.socket.getOutputStream().flush();
        packet.out.println(returnPolicy);
        packet.out.flush();
        return;
    }

**“ packet”是我的套接字客戶端包裝對象,具有“ out”字段,是“ PrintWritter”類的對象**

我不知道為什么我的Flash游戲無法收到xml消息(總是超時),我可以增加更多時間來請求策略文件嗎?我可以創建新的策略服務器嗎?

問題解決了,我必須創建一個新的策略服務器並偵聽端口843,而不是使用游戲服務器來響應策略消息。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM