2 Replies Latest reply on Sep 22, 2010 4:14 AM by MazAwushu

    Detect peer diconnection

    MazAwushu Level 1

      Hello,

       

      I'm trying to make one peer application detect when another connected peer disconnets (for example just closes the browser window).

      I tried adding NetStatusEvent.NET_STATUS to all the opened NetStreams and I also tried adding the onPeerDisconnect handlers to NetStream clients. None of them fire when peer disconnects.

       

      However, onPeerConnect works perfectly fine for me.

      Any ideas?

      Thanks!

        • 1. Re: Detect peer diconnection
          AdamLane Level 1

          I think that when a peer connection closes, you will see a NetStream.Connect.Closed status

          event on the NetConnection.  So, install an NetEvent handler on the NetConnection and look for NetStream.Connect.Closed events.

          That particular event will have a property called "stream" which indicates which NetStream closed.

          • 2. Re: Detect peer diconnection
            MazAwushu Level 1

            Thanks a lot, it works perfectly fine now.

            Just to make it totaly clear, for anyone having the same problem:

             

            - you have to add the NetStatusEvent.NET_STATUS to the NetConnection object, and NOT to the NetStream object.

             

            Cheers!