Skip to main content
New Participant
August 20, 2010
Question

Air 2.0.3.13070 and XMLSockets

  • August 20, 2010
  • 1 reply
  • 1226 views

I have a few applications that use a single or multiple XML sockets, but after users are updating to 2.0.3.13070 they experience sporadic disconnects from the servers.

Is there any known issue that could be causing this? Or has the XMLSocket changed in some way?

Cheers

This topic has been closed for replies.

1 reply

chris.campbell
Community Manager
Community Manager
August 20, 2010

Hi,

Thanks for bringing this issue to our attention.  I don't know of any changes to XMLSockets, but I'd like to help investigate.  Do you have any sample code or application that we can test with to reproduce the problem?  Have you found this occurs cross platform?  And did this occur with the original AIR 2.0.2 release?

If you'd like to privately send code or an application, please feel free to email me at ccampbel@adobe.com.  Please remove the attachment's file extension so it can get past our email filter.

Thanks,

Chris

New Participant
August 31, 2010

Is there any update if this truly was a bug in Air 2.0.3.13070?

I am running into the same issue with my application. With mine the error does not occur with Air 2.0.2.12610.

chris.campbell
Community Manager
Community Manager
September 2, 2010

Here's the code I've been using to try and reproduce the disconnect.  I'm running on Windows 7, the server is using ActivePython 2.6 and my AIR apps have been built with Flex 4.1 / AIR 2 and running on AIR 2.0.3 runtime.  No luck so far...

chat.py

# import socket and select module import socket, select # define checkData function that is the core of our Socket comunication def checkData(): #create an infinitive loop to check data from an AIR client to another one      while True:      # use select module to allow an application to wait for input from multiple sockets at a time           inputready,outputready,exceptready = select.select(input,[],[])           for s in inputready:                      if s == theSock:                           # add a client to the socket connection                           client, address = theSock.accept()                           input.append(client)                      else:                     try:                                                    # comunication between client and server: manage traffic data                                     data = s.recv(1024)                                     # in tempConn we put all client without server connection                                     tempConn = input[1:len(input)]                                     if data:                                          for i in tempConn:                                               # send to all client any messages                                               i.send(str(i.getsockname()[0]) + ": " + data)                                     else:                               client.close()                               input.remove(s)                     except socket.error, e:                          # Remove                          inputs.remove(s) #define socket connection: address, port and type of socket connection theAddress = ('localhost',1024) theSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) theSock.bind(theAddress) theSock.listen(5) input = [theSock] #after established XMLSocket connection, manage messages from client checkData()

and XMLSocketTest.mxml

<?xml version="1.0" encoding="utf-8"?> <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"                             xmlns:s="library://ns.adobe.com/flex/spark"                             xmlns:mx="library://ns.adobe.com/flex/mx"                             creationComplete="init()"                             showStatusBar="false">            <fx:Declarations>           <!-- Place non-visual elements (e.g., services, value objects) here -->      </fx:Declarations>            <fx:Script>           <![CDATA[                import flash.utils.getTimer;                private var srv:XMLSocket;                private var ping:Timer = null;                private var startTime:Number;                                private function init():void                {                     startTime = getTimer();                                          srv = new XMLSocket();                                          srv.addEventListener(Event.CLOSE, closeHandler);                     srv.addEventListener(Event.CONNECT, connectHandler);                     srv.addEventListener(DataEvent.DATA, dataHandler);                     srv.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);                     srv.addEventListener(ProgressEvent.PROGRESS, progressHandler);                     srv.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);                                          srv.connect("localhost", 1024);                }                                private function progressHandler(e:Event):void                {                     chatOutput.text += "ProgressEvent.PROGRESS \n";                }                                private function securityErrorHandler(e:Event):void                {                     chatOutput.text += "SecurityErrorEvent.SECURITY_ERROR \n";                     exitChat();                }                                private function closeHandler(e:Event):void                {                     chatOutput.text += "Event.CLOSE \n";                                          exitChat();                }                                private function exitChat():void                {                     var endTime:Number = getTimer();                     var totalSeconds:Number = (endTime - startTime) / 1000;                     chatOutput.text += "Total Time: " + totalSeconds + " seconds \n";                                          if (ping)                          ping.stop();                }                private function connectHandler(e:Event):void                {                     chatOutput.text += "Event.CONNECT \n";                                          // Start the ping timer                     ping = new Timer(5000);                     ping.addEventListener("timer", pingHandler);                     ping.start();                }                                public function pingHandler(event:TimerEvent):void                {                     srv.send("pong");                }                                private function ioErrorHandler(e:IOErrorEvent):void                {                     chatOutput.text += e.text + "\n";                     exitChat();                }                                private function dataHandler(e:DataEvent):void                {                     chatOutput.text += e.data + "\n";                }                                private function sendMessage():void                {                          srv.send(chatInput.text);                     chatInput.text = "";                }           ]]>      </fx:Script>            <mx:VBox width="100%" height="100%">                      <mx:TextArea id="chatOutput" editable="false" width="100%" height="100%" valueCommit="chatOutput.verticalScrollPosition=chatOutput.maxVerticalScrollPosition" />           <mx:HBox width="100%">                <mx:TextInput id="chatInput" width="100%" enter="sendMessage()"/>                <mx:Button label="Send" click="sendMessage()"/>           </mx:HBox>                 </mx:VBox>       </s:WindowedApplication>


I've run my test for 48 hours so far and I haven't seen any disconnects.  For those that have seen this occur, does it happen on all OS's?  Am I missing something critical in my test code posted above?

Thanks,

Chris