I notice a strange behavior while I make a multipart request. I'm getting a
multipart from a IP camera that send JPEG image in the body. The reading
function works, but if the multipart content-length goes over 50KBytes I have experience too much time consuming of the CPU. I think that the reading of the input stream is the problem: probably the problem is the length used for the allocation of the buffer. For some reason when I read the input stream of the Multipart I got this behavior for the reading function:
-read 1 byte and then some(for examples 64) bytes
-then again 1 byte and than some bytes.
I'm in a local network so the data transfer is fast. The reading function _Xsgetn_s of the streambuf is implemented with a loop that read all the input stream and this consume too much CPU time. Is there a way to tell to HttpInputStream to retrieve all the body, or all the part so that when I read the input stream I can read it in once? Or is there any way to specify the buffer to use in the MultipartInputStream so I can loop less times and waste less CPU time?
I notice that if I read a lot of bytes(even 100 or 500 kb) from HttpInputStream is not a problem (I think that the buffer in that case is 4000bytes). Instead if I read from MultipartInputStream I got cpu time consuming (I think that in this case the buffer is 1024bytes)
I look at the nextpart function of the multipart, and I think that is not so efficent to delete and reallocate the MultipartInputStream for every part.
Have someone experience this behavior?
Thanks





