             }
         }
 
+        private function poll_for_id():void
+        {
+            var s_f:Socket = new Socket();
+            s_f.addEventListener(Event.CONNECT, function (e:Event):void {
+                puts("Facilitator: connected to " + fac_addr.host + ":" + fac_addr.port + ".");
+                s_f.writeUTFBytes("GET / HTTP/1.0\r\n\r\n");
+            });
+            s_f.addEventListener(Event.CLOSE, function (e:Event):void {
+                puts("Facilitator: connection closed.");
+            });
+            s_f.addEventListener(IOErrorEvent.IO_ERROR, function (e:IOErrorEvent):void {
+                puts("Facilitator: I/O error: " + e.text + ".");
+            });
+            s_f.addEventListener(ProgressEvent.SOCKET_DATA, function (e:ProgressEvent):void {
+                var clientID:String = s_f.readMultiByte(e.bytesLoaded, "utf-8");
+                puts("Facilitator: got \"" + clientID + "\"");
+                if (clientID != "Registration list empty") {
+                    puts("Connecting to " + clientID + ".");
+                    var rcp:RTMFPConnectionPair = new RTMFPConnectionPair(circon, tor_addr, output_text);
+                    rcp.addEventListener(Event.CONNECT, rcp_connect_event);
+                    rcp.addEventListener(Event.CLOSE, rcp_close_event);
+                    rcp.connect(clientID);
+                } else {
+                    /* Need to clear any outstanding timers to ensure
+                     * that only one timer ever runs. */
+                    clearTimeout(fac_poll_timeo_id);
+                    fac_poll_timeo_id = setTimeout(poll_for_id, FACILITATOR_POLL_INTERVAL); 
+                }
+            });
+            s_f.addEventListener(SecurityErrorEvent.SECURITY_ERROR, function (e:SecurityErrorEvent):void {
+                puts("Facilitator: security error: " + e.text + ".");
+            });
+
+            s_f.connect(fac_addr.host, fac_addr.port);
+ 
+        }
+
         private function rcp_connect_event(e:Event):void
         {
             puts("RTMFPConnectionPair connected");


            /* FIXME: Do I need to unregister the event listeners so
             * that the system can garbage collect the rcp object? */
        }

        private function register_id(id:String, fac_addr:Object):void

                clearInterval(circon_timeo_id);
                
                if(proxy_mode) {
                   poll_for_id(); 
                } else {
                    puts("Setting up listening RTMFPConnectionPair");
                    var rcp:RTMFPConnectionPair = new RTMFPConnectionPair(circon, tor_addr, output_text);
