This week, after a lot of struggle with transmitting and receiving the bitstream, I finally managed to successfully transmit the bitstream using curl and receive it on the PIC32 and write it to the flash. HTTP 1.1 transmits long messages in 2 parts, headers, and the body. After receiving the headers a “100-Continue” header should be transmitted in order to receive the body of the message. However, in HTTP 1.0 “Expected: 100-Continue” is not needed, which means the whole message including the headers is sent at once.
curl -k -0 -X PUT –data @bitstream http://<IP address>
-0 indicates HTTP 1.0
-X PUT indicates the method(PUT)
Another problem I faced was that the TCPIP stack has to be reinitialized during the receiving process. Basically every time the socket is read, TCPIP stack also has to also be reinitialized. In order to receive the whole length of the data, I had to increase the receiving buffer size and also the number of buffers.