0 Replies Latest reply on Feb 22, 2010 8:41 AM by this.sonix

    Socket data progress on "write"

    this.sonix

      Hi,

       

      I have a problem with the Socket determining how much data is already written/sent through a socket connection on Flex (not AIR).

      What I am doing is: first loading an image using the FileReference.load() function and later sending the byteArray to a RESTful server backend using HTTP_PUT. Its working fine that way, but I am now missing a way to figure out how far the "upload" is going.

       

      The Socket is done as followed:

       

      request.writeUTFBytes(header); // header is String

      request.writeBytes(data, 0, data.length); // data is the image-ByteArray

      socket.writeBytes(request);

      socket.flush();

       

      On socket.flush() the data is written to the outputStream, but I don't have a clue to see how much bytes are already written.

       

      I know I could use the FileReference.upload() function which provides a ProgressEvent, but I can't do the upload via HTTP_POST.

       

       

      Does anyone have a clue how to get a progress on a socket write?

      - Daniel