1 Reply Latest reply on Aug 12, 2012 4:43 AM by MrCodeghost

    NetConnection.Connect.Closed not raised in iPhone on server shut down

    MrCodeghost

      I have a video app written in Flex (4.6/3.2) which monitors it's connection to the server to report video quality and disconnects. Everything works fine in Android with all events I've attempted correctly notified and handled however, in iOS if I focibly shut down my server I do not receive a NetConnection.Connect.Closed event in my handler (or any other event).

       

      Has anyone else seen this behaviour?

        • 1. Re: NetConnection.Connect.Closed not raised in iPhone on server shut down
          MrCodeghost Level 1

          Found this - http://help.adobe.com/en_US/flashmediaserver/devguide/WSae44d1d92c7021ff-1f5381712889cd7b5 6-8000.html

           

          Monitoring a connection on a mobile device

          Some mobile devices cannot receive a "NetConnection.Connect.Closed" message. In this case, you can monitor the NetStream.bufferLength and NetStreamInfo.byteCount properties in a timer to discover network issues. When NetStream.bufferLength is less than NetStream.bufferTime, and NetStreamInfo.byteCount is not increasing, there are probably network issues.

          netStreamMonitorTimer.start();

          netStreamMonitorTimer.addEventListener(TimerEvent.TIMER, timerHandler);

          lastByteCount = 0;

          private function timerHandler(e:TimerEvent):void{

               if(netstream.bufferLength < netstream.bufferTime && netstream.info.byteCount == lastByteCount) {

                    // Network has issues.. reconnect to a new NetConnection

                    netconnection2 = new NetConnection(); ///on NetConnection.Connect.Success:

                    netStream.attach(netconnection2);

               }

               lastByteCount = netstream.info.byteCount;

          }