Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6623243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:30:35+00:00 2026-05-25T21:30:35+00:00

I use Actionscript 3 TCP sockets to connect with Javascript websockets. Sending data is

  • 0

I use Actionscript 3 TCP sockets to connect with Javascript websockets. Sending data is primarily from the websocket to the AS socket.

On Mac OS X, no problem. On Windows however, successive TCP messages seem to queue up somewhere. This causes the ProgressEvent.SOCKET_DATA event to fire with quite a large time interval, which creates noticeable lag.

I used Wireshark to monitor the TCP packets on both OS X and Windows. The difference I see is that on OS X each message comes in it’s own packet, while on Windows successive messages are ‘concatenated’ into one packet.

Is this just the way the socket is implemented, or is there any way I can improve on this?

EDIT 1: I found this post on actionscript.org which outlines the same problem

EDIT 2: I found a way to go around the problem. I pad every message with dummy text to increase the frame size. This causes the TCP stack to send every message in it’s own frame instead if queuing them. This works, even though it’s really, really ugly…


This is the code in the SOCKET_DATA event.

while(this.socket.bytesAvailable) {
    var byte:uint = this.socket.readUnsignedByte();
    if(byte == 0x00) {
        trace("Start byte found. - " + new Date().time);
        this.incomingMessageBytes = new ByteArray();
    } else if (byte == 0xFF) {
        trace("End byte found. Dispatching. - " + new Date().time);
        this.incomingMessageBytes.position = 0;
        var msg:String = incomingMessageBytes.readUTFBytes(incomingMessageBytes.bytesAvailable);
        var decodedMessage:Object = JSON.decode(msg, false);
        var message = new Message(decodedMessage.clientId, decodedMessage.command, decodedMessage.data);

        this.dispatchEvent(new MessageReceivedEvent(MessageReceivedEvent.RECEIVED_MESSAGE, message));
    } else {
        //trace("Appending.");
        this.incomingMessageBytes.writeByte(byte);
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:30:36+00:00Added an answer on May 25, 2026 at 9:30 pm

    It sounds like you might be seeing the effects of Nagle’s algorithm. I don’t know if there is a way to disable Nagle’s algorithm (aka setting the TCP_NODELAY flag) under ActionScript, but if there is, you might try doing that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use SAPI Text-To-Speech engine from my ActionScript or Air application. is
How do I reference a fla component from an actionscript project? I use flex
I currently use TextMate for Ruby/Javascript/Actionscript development and it is amazing. But one thing
OKay I don't use actionscript and trying to help my friend edit a flash
I'm trying to learn how to use actionscript over mxml for flexibility. I have
In Actionscript 3, most events use the capture/target/bubble model, which is pretty popular nowadays:
I am working on an Actionscript 2 project - trying to use the XML
We are writing an app that will use T4 to generate Flex/Actionscript to compile
How can I show an confirmation message in Actionscript 3 ? I use Adobe
I'm making a small quiz-application in Flash (and ActionScript 3). Decided to use the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.