Tool/software: TI-RTOS
All.
I've a strange issue regarding the downloading of a file over http protocol.
I set up a http server over my board, in order to export internal files, that are stored into a flash filesystem, to a local pc.
The stored file is correct (I've also a such kind of export via USB protocol and all is fine).
The issue observed consist of a wrong nibble in a random place, e.g.:
- the right nibble should be 0001 or 0010 or 0100 but on the file the nibble becomes 1001 or 1010 or 1100.
Such error is always located in the first nibble and bit #4.
The piece of code used to download file is the following:
----------------------------------------------------
Begin of C code
---------------------------------------------------
totalBytesCopied = 0;
bytesRead = APPDATA_GENERIC_BUFFER_SIZE;
byteSize = htmlFilesize;
httpSendStatusLine(htmlSock, HTTP_OK, CONTENT_TYPE_APPLET ); /* Send the HTTP status line */
sprintf( httpBuffer, "Content-Disposition: attachment; filename=%s;\r\n", &filename[1] );
httpSendClientStr( htmlSock, httpBuffer );
httpSendClientStr( htmlSock, "Accept-Ranges: bytes\r\n");
sprintf( httpBuffer, "Content-Length: %d\r\n\r\n", htmlFilesize );
httpSendClientStr( htmlSock, httpBuffer );
while( TRUE )
{
if( byteSize == 0 ) break;
if( byteSize < bytesRead ) { bytesRead = byteSize; }
memcpy( appDataGenc.buffer, (unsigned char*)(fatFSBuffer + totalBytesCopied), bytesRead );
totalBytesCopied += bytesRead;
ret = send( htmlSock, (char*)appDataGenc.buffer, bytesRead, 0 );
if( ret == -1 ) { OS_Error( "send socket error (-1)" ); break; }
if( ret < bytesRead ) { OS_Error( "send socket error bytes" ); break; }
byteSize -= bytesRead;
}
----------------------------------------------------
End of C code
---------------------------------------------------
Now I'm going to do some more test, but I would appreciate if there are any suggestion regarding this issue.
Regards,
Marco Crivellari