Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

I've made some test application which, by idea, should receive and store small files into device.

So, I'm using IWeb to create the connection and retrieve data, but when I\m retrieving file, size is 3933 bytes, I have issue - first 1/3 (approximately) of data is absolutely identical to the original, but next all data is 0x00... Length of received data is 3933 bytes(as original file size)
Maybe, for big data block I have to use IHeap interface?

This is how I retrieve data:

void HttpConnect::WebAction_CallBack(void *__pData){
pApp *pData=(pApp *)__pData;
WebRespInfo *pwri;
pwri = IWEBRESP_GetInfo(pData->Web->pIWebResp);

if (pwri->lContentLength > 0)
{
// here, malloc for 3933 bytes 
char* responceDataBuffer =(char *)MALLOC(pwri->lContentLength);
char* prb = responceDataBuffer;

ISOURCE_Read(pwri->pisMessage,responceDataBuffer,pwri->lContentLength);

// debug output begins…
DBGPRINTF("**________ got response...\n ** Body: \n");

char* strbuff = (char*)MALLOC(sizeof(char) * 73);
for (int i = 0; i < pwri->lContentLength; i+= 72)
{
STRCPY(strbuff,(prb + i));
strbuff[72] = 0;
DBGPRINTF("[ %s ]", strbuff );
}

FREE(strbuff);

// debug ends…

return ;
}

3933 bytes won't fit in a single packet. You need to check the result from ISOURCE_Read, restarting the callback with ISOURCE_Readable until you get ISOURCE_END.

3933 bytes won't fit in a single packet. You need to check the result from ISOURCE_Read, restarting the callback with ISOURCE_Readable until you get ISOURCE_END.

Yepp, It really gets only a bit bigger than 1 kb per one time, so ISOURCE_Readable should be...
...and U can check how much U read : int a = ISOURCE_Read(...)
and compare with lContentLength for WebRespInfo... - if a less - when U shoul call to ISOURCE_Readable...

Yepp, It really gets only a bit bigger than 1 kb per one time, so ISOURCE_Readable should be...
...and U can check how much U read : int a = ISOURCE_Read(...)
and compare with lContentLength for WebRespInfo... - if a less - when U shoul call to ISOURCE_Readable...