0 Replies Latest reply on Jul 14, 2011 1:26 AM by sh4nx0r

    How to break connections between 2 connected peers simultaneously ?

    sh4nx0r

      Hi adobians !

       

      I am working on RTMFP protocol and my application is just a 1-1 simple chat.

       

      When i open the application , after the netconnection success event , i get the nearID and keep waiting for the chat partner.

      Now i open the same application on another tab and i get a different nearID.

      So what i do is exchange those ids between 2 apps manually (as u all know) and the two streams are now connected to each other.

      Let the call them as User A and User B.

       

      All the messages are successfully exchanged using the NetStream.send() method between 2 users.

      Example:

      User A: Hi

      User B:Hello

       

      Now User A want to disconnect User B and connect to him (User B) again. I use this code to disconnect User B from User A

       

          var nsPeer:NetStream = ns.peerStreams[0]; //peerStreams[0] since there is only 1 stream connected
          nsPeer.close();

      This successfully disconnects the UserB when this is called from User A disconnect button.

       

       

      Now the main problem is .... When i connect the streams again the I GET THE CHAT MESSAGE FROM UserB TWICE !

      Example:

      User A:I am back

      User B:Welcome

      User B:Welcome

      (I guess UserB is still holding UserA's old stream)

       

       

      Is it possible to disconnect the stream from UserB simultaneously when UserA calls disconnect first ?

       

       

      Please help.