      */
     protected function socketError (event :IOErrorEvent) :void
     {
-        // if we're trying ports, try the next one.
+        // if we're still trying ports, try the next one.
         if (_portIdx != -1) {
-            _portIdx++;
-            if (logonToPort()) {
+            if (attemptLogon(_portIdx+1)) {
                 return;
             }
         }

        _outStream = new ObjectOutputStream(_outBuffer);
        _inStream = new ObjectInputStream();

        _portIdx = 0;
        logonToPort();
    }

    public function logoff () :void

     */
    protected function socketOpened (event :Event) :void
    {
        // reset our port index now that we're successfully logged on; this way if the socket
        // fails, we won't think that we're in the middle of trying to logon
        _portIdx = -1;

        // check for a logoff message
        for each (var message :UpstreamMessage in _outq) {
            if (message is LogoffRequest) {
