0 Replies Latest reply on Mar 5, 2008 5:06 AM by Sunilnairg

    XMLSocket Class

      My Flex Application is using XMLSocketClass for communicating with Webserver. But connection cannot be established. I am not getting any error message.
      I am using the follwing code for establishing the connection:
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="vertical">

      import mx.controls.Alert;
      import mx.collections.ArrayCollection;
      import flash.net.Socket;
      private var socket:XMLSocket;

      private function connectToServer():void
      socket = new flash.net.XMLSocket();
      socket.connect("", 8002);
      function sendData()
      var xmlvalue:String=txtData.text.toString()
      var xmlfile:String="<command>GetRevision</command>"
      private function getData()
      socket.addEventListener(DataEvent.DATA, onData);
      private function onData(event:DataEvent):void {
      trace("[" + event.type + "] " + event.data);

      <mx:HBox width="80%" horizontalAlign="center">
      <mx:TextInput id="txtData" name=""/>

      <mx:Button id="btnConnect" label="Connect" click="connectToServer();btnConnect.enabled = false"/>
      <mx:Button id="btnSend" label="Send Data" click="sendData()"/>
      <mx:Button label="getData" id="btnGet" click="getData()"/>



      Please help me to handle this error.