Zurück   Flashforum > Flash und Server > Flash mit XML und Webservices

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 12-12-2007, 16:56   #1 (permalink)
Neuer User
 
Registriert seit: Jul 2001
Beiträge: 96
XMLSocket - Problem

Hallo,

ich habe eine FlashAnwendung, die über einen XMLSocket mit einem Java-Server kommuniziert.

Lokal funktioniert unter Tomcat alles, nur auf dem WebServer nicht...

LOG:

XMLParser: Start element is policy-file-request
XMLParser: root element is null and qName is policy-file-request
No methods for this root element

XMLParser: endElement: policy-file-request
Competition Client: Finally released client
CompetitionClient: actualCompetition is null
Competition Server: Competition Server: [11/12/2007 16:11:11] Competition Server: Player with id = 0 has left the server.

Ich denke mal, da er keine Antwort bekommt, wird die Verbindung unterbrochen...

deshalb habe ich folgendes in die Flash-App. gepackt:

System.security.loadPolicyFile("http://xxx.xx.xx.xx:2010");
connect("xxx.xx.xx.xx", 2010);

und bekomme vom Server...

else if(rootElement.equals("policy-file-request")){
competitionClient.send("<cross-domain-policy><allow-access-from domain=\"*\" to-ports=\"2010\"/></cross-domain-policy>");
}

zurück...

Funktioniert aber nicht... der Client bekommt einen "onClose"...

Was mache ich falsch?

Danke für Tipps,

Chris

Hier noch die kompl. Socket-Klasse:

class SocketManager extends XMLSocket{

var controller:Controller;

function SocketManager() {
super();
trace("SocketMananager: created and trying to connect...");
//connect("127.0.0.1", 2010);
System.security.loadPolicyFile("http://xxx.xxx.xx.xx:2010");
connect("xxx.xx.xx.xx", 2010);
onConnect = handleConnect;
onData = handleData;
onClose = handleClose;
onXML = handleXML;
}

private function handleConnect(success:Boolean){
// Tell the User the Connection is established
if(success) trace("SocketManager: Tell the User the Connection is established");
else trace("SocketManager: Tell the User the Connection couldn't be established");
}

private function handleData(xmlData){
trace("SocketManager: in handleData - Data from Server: " + xmlData);
XMLParser.parseXML(new XML(xmlData), this.controller);
}

private function handleClose(){
trace("SocketManager: in handleClose");
}

private function handleXML(xmlData:XML){
trace("SocketManager: in handleXML");
XMLParser.parseXML(xmlData, controller);
}

public function sendDataToServer(xmlData:XML, controller:Controller){
trace("SocketManager: in sendDataToServer");
this.controller = controller;
send(xmlData);
}
}

und die Ausgabe:

Socket-Verbindung mit 141.45.29.17 hergestellt.
SocketManager: handle connection to 141.45.29.17
SocketManager: Tell the User the Connection is established
SocketManager: in handleData - Data from Server: Number of Clients at the Server: 1
-- XMLParser is created!!! --

XMLParser: Number of Child Nodes0
XMLParser: The root node: null
--null
--undefined
XMLParser: Root node not valid
XMLParser: RootNode is null

und wenn ich dann die Logindaten sende:

SocketManager: in sendDataToServer
Socket-Verbindung geschlossen für 141.45.29.17.
SocketManager: in handleClose

Geändert von Chris1977 (12-12-2007 um 17:26 Uhr)
Chris1977 ist offline   Mit Zitat antworten
Alt 06-01-2008, 12:43   #2 (permalink)
aus Berlin
 
Registriert seit: Feb 2002
Ort: Berlin
Beiträge: 516
eine Vermutung ist:

competitionClient.send("<cross-domain-policy><allow-access-from domain=\"*\" to-ports=\"2010\"/></cross-domain-policy>");

muss mit einem null-byte terminiert werden.

da ich java kaum kann habe ich sowas mit c# realisiert und so sieht meine Lösung aus:

Code:
       String strDateLine = "<cross-domain-policy><allow-access-from domain=\"*\" to-ports=\"*\" /></cross-domain-policy>\0";
       Byte[] byteDateLine = System.Text.Encoding.GetEncoding("utf-8").GetBytes(strDateLine.ToCharArray());
       client.Sock.Send(byteDateLine, byteDateLine.Length, 0);

Geändert von ArBr (06-01-2008 um 12:44 Uhr)
ArBr ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 04:19 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele