0 Replies Latest reply on Dec 20, 2009 10:26 PM by @flash

    how to reconnect a socket connection when it drops ?

    @flash Level 1

      hi


      i have created a socket connection.  suppose when the socket connection drops, i need to reconnect them for three times. If it fails at third time, i need to show some popup message.

       

      I not sure on how to do this.
      Can any one help on this...

      Below is my code


      myXML = new XMLSocket;
      myXML.onConnect = handleConnect;
      myXML.onXML = handleXML;
      myXML.onClose = handleDisconnect;

      myXML.connect("servername", port);
      function handleConnect(connectionStatus){
      connectionStatus ? trace("Connected.") : trace("Connection failed.");
      }
      function handleXML(xmlObject){
      trace("Object recieved:: "+xmlObject);
      }
      function sendXML(textToSend){
      myXML.send(new XML('"+textToSend+"'));
      }
      function handleDisconnect(){
      trace("Connection lost.");
      }




      Thanks in advance

      ayathas