In my project I am sending *.bin firmware file(~70 kB) from computer to W5500 chip using method http POST.
Http form for post request looks like:
“<form action =”“/firmware”" enctype=““multipart/form-data”” method=““post””>"
“
Choose firmware file *.bin: "
“ ”
“<input type=”“file”” name=““datafile”” size=““40"”>”
“<input type=”“submit”" value=““Upload””>"
After processing first packet in http_process_handler() we start to receive next packets with this code:
for(; {
if((nbytesRSV = getSn_RX_RSR(SOCK_HTTP_SERVER)) > 0){
receiveSizeBuf[receiveIndex++] = nbytesRSV;
nbytesRSV = recv(SOCK_HTTP_SERVER, RX_HTTP_BUF, nbytesRSV);
if(nbytesRSV > 0){
rsvPacketNum++;
return receiveDataPacket(buf,receiveSizeBuf[receiveIndex-1]);
}
}
}
But I have a problem with number of received bytes. Value of nbytesRSV variable is bigger than a packet size. nbytesRSV equal to number of remained bytes in file and it exceeds size of RX buffer
For example with test file which size is 5,37 kBytes size of first received packet is 661 Bytes, second received pakcet size is 5704 Bytes.
However WireShark says that size of first packet 661 but second, third and forth is 1460 Bytes, last is 1378.
Also I see that timeout between first packet and second packet is about 100 us, but further packets send without any timeout.
Maybe I need to add something in my http form for additional timeout or in my code?
Problem is solved. I’d made a timeout with java script. File is sending with script which is making determined timeouts bitween sending chunks. Size of chunk and timeout can be set
Here is a code of html page: