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 7760137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:48:13+00:00 2026-06-01T13:48:13+00:00

I am having an issue with sockets where the data I’m sending is getting

  • 0

I am having an issue with sockets where the data I’m sending is getting truncated on the client side (Flash/Flex). The data that is sent by my server is full and in tact, but flash does not wait the appropriate amount of time before firing an event saying to read the data. This results in the data not getting fully read and (as such) I can’t parse the object out of it after that. We are exploring the possibility of stripping the object into smaller chunks, but the idea is for it to be as lightweight as possible so we would much rather get it to work the way it’s supposed to than patch in a temporary solution.

I’m not entirely sure if referring to it as the receive ‘buffer’ is correct, as some computers are able to receive all of the data and others are having it truncated (which means the buffer is adequate but flash isn’t waiting the appropriate amount of time to dispatch the event for whatever the reason)…If anyone has any ideas I would greatly appreciate them!

  • 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-06-01T13:48:15+00:00Added an answer on June 1, 2026 at 1:48 pm

    Without seeing code of your implementation, it sounds like bytes available or total bytes are not being accounted for.

    Here is an implementation I have used:

    package
    {
        import flash.events.Event;
        import flash.events.EventDispatcher;
        import flash.events.IOErrorEvent;
        import flash.events.ProgressEvent;
        import flash.events.SecurityErrorEvent;
        import flash.net.Socket;
    
        public class WebRequestService extends EventDispatcher
        {
    
            //------------------------------
            //  model
            //------------------------------
    
            protected var hostname:String;
    
            protected var port:uint;
    
            public var requestMessage:String;
    
            public var responseMessage:String;
    
            private var _socket:Socket;
    
    
            //------------------------------
            //  lifecycle
            //------------------------------
    
            public function WebRequestService(hostname:String, port:uint, requestMessage:String)
            {
                this.hostname = hostname;
                this.port = port;
                this.requestMessage = requestMessage;
    
                _socket = new Socket();
                _socket.addEventListener(Event.CONNECT, socketConnectHandler);
                _socket.addEventListener(ProgressEvent.SOCKET_DATA, socketDataHandler);
                _socket.addEventListener(Event.CLOSE, socketCloseHandler);
                _socket.addEventListener(IOErrorEvent.IO_ERROR, socketErrorHandler);
                _socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, socketSecurityErrorHandler);
    
                _socket.connect(hostname, port);
            }
    
            protected function socketConnectHandler(event:Event):void
            {
                responseMessage = "";
                _socket.writeUTFBytes(requestMessage);
                _socket.flush();
            }
    
            protected function socketDataHandler(event:ProgressEvent):void
            {
                while (_socket.bytesAvailable > 4)
                {
                    responseMessage += _socket.readUTFBytes(_socket.bytesAvailable);
                }
            }
    
            protected function socketCloseHandler(event:Event):void
            {
                dispose();
            }
    
            protected function socketErrorHandler(event:IOErrorEvent):void
            {
                trace("socket error.");
            }
    
            protected function socketSecurityErrorHandler(event:SecurityErrorEvent):void
            {
                trace("socket security error.");
            }
    
            public function dispose():void
            {
                if (!_socket)
                    return;
    
                if (_socket.connected)
                    _socket.close();
    
                _socket.removeEventListener(Event.CONNECT, socketConnectHandler);
                _socket.removeEventListener(ProgressEvent.SOCKET_DATA, socketDataHandler);
                _socket.removeEventListener(Event.CLOSE, socketCloseHandler);
                _socket.removeEventListener(IOErrorEvent.IO_ERROR, socketErrorHandler);
                _socket.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, socketSecurityErrorHandler);
            }
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a client that connects to server, starts sending binary data and when
I having issue that content assistant / intellisense is working in methods such as
Having an issue here that I have tried everything I can think of but
I'm having an issue with a rather intricate interaction of C++ and Python that
I'm writing a UDP server that currently receives data from UDP wraps it up
I am having issues reading data from a socket. Supposedly, there is a server
I am having a few issues with sockets within my Java SIP client. When
I'm currently having a problem passing messages between a server and client. As far
I am writing a C# .NET server application that sends and receives data over
I have been having a heck of a time getting Udp sockets working correctly

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.