• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
POST with file and bytes written
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

POST with file and bytes written


  • Subject: POST with file and bytes written
  • From: Fielke Gary <email@hidden>
  • Date: Sun, 27 Nov 2005 23:07:02 +1030

I am using a CFHTTPMessageRef and CFReadStreamCreateForHTTPRequest to send a form post with a single file.

The post and file upload work fine, the read stream is scheduled on a run loop and everything looks good.
I am wanting to retrieve, during the upload, the file upload progress using the following:

CFNumberRef bytesWritten = (CFNumberRef)CFReadStreamCopyProperty(httpReqStream, kCFStreamPropertyHTTPRequestBytesWrittenCount);

The numbers I get for bytesWritten are a little odd.

a) the first bytesWritten value obtained is always around 67k (unless the size of the file is less than this in which case it will be the file size, say 40k)
b) sampling the bytesWritten value every second, it increases as expected until it gets to the message body size (just over the file size) - lets say 150k.
c) the file upload hasn't completed yet however, and the following bytesWritten values are fixed at the size of the message body.

So, the values I get for a 150k message body upload by retrieving the bytesWritten every second are the following:

67k, 71k, 74k, 79k.........143k, 147k, 150k, 150k, 150k, 150k, 150k.

For a small file/message body size of say 40k I get:

40k, 40k, 40k.....40k, 40k. (not particularly useful!)


It appears as if the kCFStreamPropertyHTTPRequestBytesWrittenCount property value is NOT returning the number of bytes that have been uploaded but the number of bytes that have been written to a pre-upload buffer of around 64kbytes in size. 

Is this exactly what's going on or have I missed something along the way? Has anyone else seen this?

Thanks
Gary
(running 10.4.3)
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: POST with file and bytes written
      • From: Frederick Cheung <email@hidden>
  • Prev by Date: Re: Socket problem using linux as server
  • Next by Date: Re: POST with file and bytes written
  • Previous by thread: Re: CFSocket freezes
  • Next by thread: Re: POST with file and bytes written
  • Index(es):
    • Date
    • Thread