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:
Not even the trace will show up.Code:var chatSocket = new XMLSocket(); chatSocket.connect("localhost", 6000); chatSocket.addEventListener(Event.CONNECT,connected); chatSocket.addEventListener(Event.CLOSE,closeConn chatSocket.addEventListener(IOErrorEvent.IO_ERROR,errorConn); chatSocket.addEventListener(DataEvent.DATA,data_sock); 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"); } }
And here's a little bit of code on the server end:
I tried ending the string with "\n" and even null value "\0" and still nothing.Code:cs.outgoing = new PrintStream(cs.connection.getOutputStream(),true); .... .... //inside of cs Object public void send(String mess) { outgoing.print(mess + "\r"); }
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.




Reply With Quote