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.htmlprivate 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);
}