PDA

View Full Version : Not getting back XML from Server


prune
07-28-2005, 01:37 AM
I am working with the socket server code from www.Shovemedia.com/multiserver.

I have verified that the server can receive the xml ok. And the server goes into the broadcast function below. however, my flash application doesn't seem to get xml (ie. trace doesn't run). I am running the swf programs and the server program on local host and my windows firewall is off.

Please shed some light on possible problem!

Action Script flash code:
---------------------------------------------------
xsock = new XMLSocket();
xsock.onConnect = sockConnect;
xsock.onClose = sockClose;
xsock.onXML = processXMLslate;
xsock.connect("127.0.0.1", 9000);
processXMLslate = function (data) {
trace("xml "+data);
};
--------------------------------------------------------------
server code in java:
---------------------------------------------------------------
protected static void broadcast (Document xmlDoc) {
Enumeration e;
synchronized (handlers) {
e=handlers.elements();
}
while (e.hasMoreElements())
{
//System.out.println("slate test broadcast ");
XmlHandler c=(XmlHandler) e.nextElement ();
if (c.thisThreadRunning)
{
try
{
synchronized (c.o) {
XMLOutputter xmlOut = new XMLOutputter ();
xmlOut.output(xmlDoc, c.o) ;
//xmlOut.output.tostring();
c.o.write (0);
c.o.flush();
System.out.println("slate test broadcast "+xmlOut.toString());
}
}
catch (IOException ex)
{
c.kill();
//System.out.println ("BROADCAST FAILURE via IO X");
}
}
}
}

------------------------------------------------------------------