;

PDA

Click to See Complete Forum and Search --> : [RESOLVED] XMLSocket not recieving data


Uberalles
06-16-2008, 10:49 PM
I had a small chat app written in AS2 and am now changing over to AS3.
I can get the XMLSocket to connect to the chat server (written in Java) but I can't get any messages back to the swf chat client.

code for the flash client:

var chatSocket = new XMLSocket();
chatSocket.connect("localhost", 6000);
chatSocket.addEventListener(Event.CONNECT,connecte d);
chatSocket.addEventListener(Event.CLOSE,closeConn
chatSocket.addEventListener(IOErrorEvent.IO_ERROR, errorConn);
chatSocket.addEventListener(DataEvent.DATA,data_so ck);

function data_sock(dt_event:DataEvent):void
{
trace("mess in");
chatarea.text +=dt_event.data;
}
function connected(evnt:Event):void
{
sendMess("T:mmm:liv");
chatarea.text = "";
chatarea.text ="Welcome to The Last Minute Tutor Live 1-on-1" + "\r";
}
function closeConn(evnt:Event):void
{
chatarea.text ="The connection has been lost";
}
function errorConn(evnt:Event):void
{
chatarea.text ="There was a network error. Please contact the site admin";
}

function sendMess(mess):void
{
if(mess != null || mess != "")
{
chatSocket.send(mess+"\r");
}
}


Not even the trace will show up.

And here's a little bit of code on the server end:


cs.outgoing = new PrintStream(cs.connection.getOutputStream(),true);
....
....
//inside of cs Object
public void send(String mess)
{
outgoing.print(mess + "\r");
}

I tried ending the string with "\n" and even null value "\0" and still nothing.
I know the send method itself is working and as I stated before I can send many messages to the chat server....I just can't get anything back.
Anyone have an idea of what might be going wrong here?
Thanks in advance.