Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

xmlsocket issue

Anonymous
Not applicable
I´m creating a flex app on a local network that usses
xmlsocket.



I can connect to the server-port from other computers but the
dataEvent doesn´t work. I use send and then ofcause expect
some kind of response but nothing happens. This is inside a flex
app that calls putData () on a button.



I used this code for a small server.
http://livedocs.adobe.com/flex/3/html/help.html?content=17_Networking_and_communications_4.html



private function init():void{

_socket = new XMLSocket();

_socket.connect("192.168.1.100", 8080);

_socket.addEventListener(DataEvent.DATA, onData);

_socket.addEventListener(Event.CONNECT, onEvent);

_socket.addEventListener(Event.CLOSE, onError);

_socket.addEventListener(IOErrorEvent.IO_ERROR, onError);

}



private function onEvent(event:Event):void {

output.text = "connected";

}



private function onError(event:Event):void {

trace(event);

output.text = "error";

}



private function onData(event:DataEvent):void {

trace( "GO" );

fromSocket.text = event.toString();

}





private function putData () :void

{

var request:String = "<register/>\n";

_socket.send(request);

}









0 Replies