0 Replies Latest reply on Oct 8, 2007 1:32 PM by yangzhou1030

    about XMLSocket reconnection

    yangzhou1030
      hello: I got a question about XMLSocket. The problem is this: if the connection is established to the server then it is done. if the connection is not successfully established then it will retry the connection 10 seconds later.

      here is my code:

      class .... {

      ....

      public function Connect():Void {
      var _isConnected:Boolean = _conn.connect(_hostIP, _hostPort);
      _conn.onConnect = function(_isConnected:Boolean):Void {
      if (_isConnected) {
      _conn.send("Hello there.");
      // MessageModule();
      } else {
      trace("No connection.");
      // Wait(); ???
      // Reconnect(); ???
      }
      }
      }

      ...
      }

      in my code I try to send "Hello there if it succeeds" while I still can't figure out how can I implement the //Wait() and //reconnect part. please give me some help. Thanks!!!!!