0

Here is my code

for ( i = 0 ; i < 2 ; i ++ ){
        socket.writeUTFBytes("Command"+i);
        socket.flush();
    }

The Question is why I add socket.flush(), others still received Command0Command1 instead of Command0 and Command1. I guest there must have some delay between first flush and second flush, so now the only thing I can do is make a timer to solve this problem. Is there other solution?

  • And I have seem this page [link]http://stackoverflow.com/questions/20772644/flex-force-socket-to-flush – Yu-Fu Lin Nov 20 '14 at 06:37
  • This one maybe helpful http://stackoverflow.com/questions/5552277/when-to-use-writeutf-and-writeutfbytes-in-bytearray-of-as3 – RST Nov 20 '14 at 06:41
  • Thanks for helping. It seems must have length of data in data stream to make sure if get the right data. – Yu-Fu Lin Nov 21 '14 at 01:08

0 Answers0