5 Replies Latest reply on Mar 23, 2010 7:52 PM by nicky23

    XML.load making persistent connection?




      We're currently having problems right now. When we do XML.load on flash application, then we do netstat on the server-side it opens a persistent connection. Im finding out the reason why its doing that, it should be close right away when the xml loading has finished. problem is the connection remains open. Any Idea what causing this? I'm using Actionscript 2 btw.





        • 1. Re: XML.load making persistent connection?
          kglad Adobe Community Professional & MVP

          are you using the xmlsocket class?

          • 2. Re: XML.load making persistent connection?
            nicky23 Level 1

            No Im not. thats the weird part. Is that possible for XML.load to create persistent connection? The connection should close automatically when the xml has loaded right? Any Idea what going on?



            • 3. Re: XML.load making persistent connection?
              kglad Adobe Community Professional & MVP

              if you're not using xmlsocket and are using the xml class' load() method, you must be repeatedly executing that load().


              show your xml related code.

              • 4. Re: XML.load making persistent connection?
                nicky23 Level 1

                Thank you for your reply. Here's the actionscript class, its only being called just once. let me know what you think:




                class com....XmlLoader extends EventDispatcher {


                public static var CLASS_REF = com.....XmlLoader;


                private static var XML_LOAD_TIMEOUT_MILLIS:Number = 2000;


                private var xmlDocument:XML;

                private var urlToXml:String;

                private var isTimeOut:Boolean;

                private var xmlTimeOut:Number;

                private var xmlTimeOutTimer;


                public function XmlLoader(urlToXml:String, xmlTimeOut:Number, eventListenerDelegate:Function) {

                this.urlToXml = urlToXml;

                this.isTimeOut = false;

                this.xmlTimeOut = xmlTimeOut;

                if(this.xmlTimeOut == null) {

                this.xmlTimeOut = XML_LOAD_TIMEOUT_MILLIS;



                addEventListener(XmlLoaderEvent.EVENT_NAME, eventListenerDelegate);



                public function loadXml():Void {

                this.xmlDocument = createXmlForLoad();




                this.xmlTimeOutTimer = setInterval(Delegate.create(this, onXmlTimeOut), xmlTimeOut);



                private function createXmlForLoad():XML {


                var xmlDoc = new XML();

                xmlDoc.ignoreWhite = true;

                xmlDoc.onLoad = Delegate.create(this, onLoadXml);


                return xmlDoc;



                private function onLoadXml(success:Boolean):Void {




                if(isTimeOut) {




                var xmlEvent;

                if(success) {

                xmlEvent = new XmlLoaderEvent(xmlDocument, EventStatus.SUCCESS, this);

                trace("DELETED XML Doc");

                delete xmlDocument;


                } else {

                xmlEvent = new XmlLoaderEvent(xmlDocument, EventStatus.FAILED, this);






                private function onXmlTimeOut():Void {



                isTimeOut = true;


                var timeOutEvent:XmlLoaderEvent = new XmlLoaderEvent(new XML(), EventStatus.TIMEOUT, this);








                Just want to clarify, XML.load doesn't make any persistent connection right? only XMLSocket. This is the scenario... when XML.load fires (HTTP Request) in the server netstat, the connection stays for about 20secs. Any idea whats causing this?


                Thanks in advance.

                • 5. Re: XML.load making persistent connection?
                  kglad Adobe Community Professional & MVP

                  what's calling loadXml()?


                  and does onLoadXML() ever get called?