0 Replies Latest reply on Apr 24, 2010 9:06 PM by kevc0722

    How to get a random peerID that is stored in MySQL database

    kevc0722

      Hi, first off I would like to say I'm very new to flash builder and actionscript, but I'm learning

      So far I'm impressed by the application.

       

      I've been trying to play around with the VideoPhoneLabs sample, trying to somehow come up with a way to random connect two peerIDs.

       

      I got through to the regsiter nearID part, but then problem came up.

      The VideoPhoneLabs example requires you to input a specific user name to lookup on, or in the modification I'm donig, a specific peerID that the lookup process have to look for.

       

      So how do I make it that the lookup process would get any peerID that's available in the database?

       

      I'll show a sample of the code I'm working on, it's still basically VideoPhoneLabs code.


      the following is in the VideoPhoneLabs.mxml

       

      // lookup friend
                  private function onCall():void
                  {
                      if (netConnection && netConnection.connected)
                      {                   
                          // first, we need to lookup callee's fingerprint using the web service
                          if (idManager)
                          {
                              idManager.lookup(netConnection.farID);
                              status("lookup callee\n");
                          }
                          else
                          {
                              status("Not registered.\n");
                              return;
                          }
                      }
                      else
                      {
                          status("Not connected.\n");
                      }
                  }


      the following are in the HttpIdManager.as (which talks to the database through a php modifed from reg.cgi

       

      override protected function doLookup(id:String):void
               {   
                   if (mHttpService)
                   {
                       var request:Object = new Object();
                      request.friends = id;
                      // when making repeated calls to the same user, it seemed that
                      // we recived cached result. So add time, to it to make it unique.
                      var now:Date = new Date();
                      request.time = now.getTime();
                      mHttpService.cancel();
                      mHttpService.send(request);
                   }
                   else
                   {
                       var e:Event = new IdManagerError("lookupFailure", "HTTP service not created");
                       dispatchEvent(e);
                   }
               }

       

      right now the above would try to fetch any farID back instead of the ones that are registered in the database.

       

      So this is basically where I'm stuck at.

      I've looked through quite a few posts and articals, and still not quite sure how random pairing is done.

      Any help or direction that points to related info would be greatly appreciated.