Sending arbitrary length data using REST library

Jan 13, 2016 at 1:32 PM

I have the following situation: I want to upload a number of data packets from client to server. Format of the request is given below.

|Length1 | Packet1 | Length2 | Pack2t2 | ... | LengthN | PacketN | 0 |

Number of packets is not known initially. Once all the packets are sent, the length 0 is sent to mark the end of http request.

Following are my restrictions:
  1. Content length of request is not known.
  2. It is not possible to prepare the complete buffer and call the http send request since the total size of data will be huge and not all the packets are available at the time of initiating the http request.
How can I achieve this in C++ REST SDK? Is there any sample code available?