2 Replies Latest reply on Aug 17, 2011 1:13 AM by jacobytong

    A problem on multiuser p2p communications


      hey guys~


      I got a problem on multiuser p2p communications.


      I want to build an app let multiusers counld send instant message as in a group. users count > 2.


      As I connected to "rtmfp://p2p.rtmfp.net", then I used a php service to exchange peerIDs. So I got an array in as3 to store these information.


      private var _allPeersInfo:Array;



      _allPeersInfo = new Array();

      for each (var userInfo in i.usersInfo) {

           var userInfoClone = new Object();

           userInfoClone.name = userInfo.name;

           userInfoClone.id = userInfo.id;

           userInfoClone.incomingStream = null;




      Then I try to get each other connected. I will pass some condition checks such as Not this peer, Not connected yet...


      for each (var userInfo in _allPeersInfo) {

           _netConnection.call(RELAY, null, userInfo.id, INVITE, Main.getInstance().txtUserName.text, _allPeersInfo);



      The first _netConnection.call() runs pretty well. And when I use the global _netconnection to connect to the second peer, I got an error like this:


      2154 The NetStream Object is invalid. This may be due to a failed NetConnection.


      How should I fix this error?  Thanks!

        • 1. Re: A problem on multiuser p2p communications
          Michael Thornburgh Adobe Employee

          you're leaving out the part where you make new NetStreams, so i can only guess how you're doing that.


          note that a NetStream object isn't serializable, so you can't send one through the "relay" call.  i'm assuming that's what .incomingStream is for.


          note also that the short message relay service on Cirrus is rate limited to 10 relays in 20 seconds, so depending on how many elements are in _allPeersInfo, some relays may not go through.

          1 person found this helpful
          • 2. Re: A problem on multiuser p2p communications
            jacobytong Level 1

            Hi, Michael. Thanks for your reply!


            As you mentioned, the error occured on serialization of the array _allPeersInfo.

            As I call function _netConnection.call() to the first peer successfully, i stored the _incomingStream to an _allPeersInfo array element's property incomingStream. When I call function _netConnection.call() secondly, the serialization problem occurs. Pretty stupid I am, hehe:)


            Thanks for your tips!