3 Replies Latest reply on Nov 28, 2009 4:48 AM by 1ndivisible

    Socket dropping packets in AIR application

    1ndivisible Level 1

      Hi,

       

      I have an AIR application that connects to a Python Socket server. It is sucessfully sending messages to the server without dropping any. However, when the server sends messages back at a rate greater than approx 1 per .5 seconds, some of them fail to arrive in the AIR app. I have set up other clients written in Python, and they receive all messages without loss. For example I can have 5 python clients connected along with the single AIR app. Out of 50 messages sent from server to its clients, all Python clients receive all 50, while the AIR client receives around 30.

       

      I am at a loss as to how to proceed, given that Socket is the lowest level class I have access to in AIR, and it seems that its ProgressEvent.SOCKET_DATA event is not being fired.

       

      Any suggestions would be appreciated as I am stumped.

       

      Thanks.

        • 1. Re: Socket dropping packets in AIR application
          oldMster Level 3

          I'm using SocketServer without experiencing this problem - I can send any amount of data through without any problem.

           

          However, I did have a problem at first, because I followed the example in the docs too closely.  In the example, the socket object created in the onConnect is not set up as a 'persistent' object, it is only set up in the onConnect function, and when that function terminates, all references to the socket go away.  This isn't immediately apparent because the socket continues to work until the garbage collector gets around to removing it.  I could connect and send data, but then at seemingly random intervals the transmissions would fail.  Once I figured out what the problem was I created a Socket object at the same 'level' I created the ServerSocket and fixed the onConnect function to  assign the socket in the event to that object, it works perfectly.

           

          Mark

          • 2. Re: Socket dropping packets in AIR application
            oldMster Level 3

            Oops, sorry, i was on the wrong forum, thought you were talking about then new serversocket provided in the AIR beta 2.0

             

            Mark

            • 3. Re: Socket dropping packets in AIR application
              1ndivisible Level 1

              Turns out that The packets were coming through, only they were getting concatenated with the previous message. I checked the length of the received socket data and it showed that some messages were double the expected length.

               

              I just read the data out as two separate messages in AIR.