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

Developer

Forums

Forums:

Hi all,
Pls tell me what is the maximum number of bytes that could be read from "ISOURCE_Read" at a time. Is this ranges from 0 to 1024 bytes or can go behind this.

While testing on the emulator, I just printed the number of bytes returned from "ISOURCE_Read", it is going beyond 1024.

If the content length==-1, I have to allocate the memory dynamically, therefore I want to know the maximum bytes that could be read from "ISOURCE_Read" at a time.

Thanks in advance,
Sumana

Quote:
Pls tell me what is the maximum number of bytes that could be read from "ISOURCE_Read" at a time. Is this ranges from 0 to 1024 bytes or can go behind this.
While testing on the emulator, I just printed the number of bytes returned from "ISOURCE_Read", it is going beyond 1024.
If the content length==-1, I have to allocate the memory dynamically, therefore I want to know the maximum bytes that could be read from "ISOURCE_Read" at a time.
From where did you get this number 1024? There is no such limitations on ISource_Read? This is a streaming source. While calling this API, user provides a buffer and the buffer size, depending upon the data availabilty ISOURCE will read data into the buffer and will return the number of bytes were read. This is standard concept of data streaming.

Quote:
Pls tell me what is the maximum number of bytes that could be read from "ISOURCE_Read" at a time. Is this ranges from 0 to 1024 bytes or can go behind this.
While testing on the emulator, I just printed the number of bytes returned from "ISOURCE_Read", it is going beyond 1024.
If the content length==-1, I have to allocate the memory dynamically, therefore I want to know the maximum bytes that could be read from "ISOURCE_Read" at a time.
From where did you get this number 1024? There is no such limitations on ISource_Read? This is a streaming source. While calling this API, user provides a buffer and the buffer size, depending upon the data availabilty ISOURCE will read data into the buffer and will return the number of bytes were read. This is standard concept of data streaming.

ISOURCE is a streaming process and it will return whatever number it has been able to obtain from the stream. This can be 1 byte or many kilobytes at a time. The best way is - at least for me - to allocate the buffer size based on the response length variable, and then start filling it from the ISOURCE stream until the end is reached - as marked by ISOURCE return value 0.

ISOURCE is a streaming process and it will return whatever number it has been able to obtain from the stream. This can be 1 byte or many kilobytes at a time. The best way is - at least for me - to allocate the buffer size based on the response length variable, and then start filling it from the ISOURCE stream until the end is reached - as marked by ISOURCE return value 0.

Thank you for your replies.
Dragon wrote:
The best way is - at least for me - to allocate the buffer size based on the response length variable, and then start filling it from the ISOURCE stream until the end is reached - as marked by ISOURCE return value 0.
If the content length "lContentLength" returned by web response is some positive number, then we can allocate the buffer size based on the response length variable.
Suppose if lContentLength==-1, I should reallocate the buffer before I try to read next chunk of data. Here what is the idel buffer size that I can use.
And what are the circumstances, for which server returns lContentLength as -1.
Regards,
Sumana

Thank you for your replies.
Dragon wrote:
The best way is - at least for me - to allocate the buffer size based on the response length variable, and then start filling it from the ISOURCE stream until the end is reached - as marked by ISOURCE return value 0.
If the content length "lContentLength" returned by web response is some positive number, then we can allocate the buffer size based on the response length variable.
Suppose if lContentLength==-1, I should reallocate the buffer before I try to read next chunk of data. Here what is the idel buffer size that I can use.
And what are the circumstances, for which server returns lContentLength as -1.
Regards,
Sumana

Quote:
And what are the circumstances, for which server returns lContentLength as -1.
dunno, ask whoever wrote the server you are connecting to.
easiest is just to consider a zero/negative content length as an error..
-Tyndal

Quote:
And what are the circumstances, for which server returns lContentLength as -1.
dunno, ask whoever wrote the server you are connecting to.
easiest is just to consider a zero/negative content length as an error..
-Tyndal

Quote:
If the content length "ContentLength" returned by web response is some positive number, then we can allocate the buffer size based on the response length variable.
Are you saying that if the content length is 1MB, you are going to allocate 1MB buffer? Get some basic understanding of data streaming from any tutorials available on net. Read data buffer size can be suitably chosen based on your application requirement.

Quote:
If the content length "ContentLength" returned by web response is some positive number, then we can allocate the buffer size based on the response length variable.
Are you saying that if the content length is 1MB, you are going to allocate 1MB buffer? Get some basic understanding of data streaming from any tutorials available on net. Read data buffer size can be suitably chosen based on your application requirement.

Well, I think people are talking about different things here. In my case I know my data and I know I will never receive a file that's 1 MB in size. All my data is very controlled so I do not really have to take excessive data into consideration.
Therefore in my case once I have the file length I allocate a buffer for the entire file and let ISOURCE drip it in until it's complete. Evidently for other applications this will not work if the incoming file is a streaming video file or such, for example.

Well, I think people are talking about different things here. In my case I know my data and I know I will never receive a file that's 1 MB in size. All my data is very controlled so I do not really have to take excessive data into consideration.
Therefore in my case once I have the file length I allocate a buffer for the entire file and let ISOURCE drip it in until it's complete. Evidently for other applications this will not work if the incoming file is a streaming video file or such, for example.

Here goes my first post to this group,
I would like to know what is the maximum number of bytes that could be read from "ISOURCE_Read" when the first chunk is read.

Here goes my first post to this group,
I would like to know what is the maximum number of bytes that could be read from "ISOURCE_Read" when the first chunk is read.

1. if you are reading data through a socket, then you can read complete data available by properly allocating the enough byte to store.
2. if one is reading it form a local file, then you can read the complete file at one go by providing the a buffer with fileize+1.
so the point is availabilty of source. There is no limit on Read until data is available..

1. if you are reading data through a socket, then you can read complete data available by properly allocating the enough byte to store.
2. if one is reading it form a local file, then you can read the complete file at one go by providing the a buffer with fileize+1.
so the point is availabilty of source. There is no limit on Read until data is available..

lContentLength : is this each chunk size or the full size that is request through IWEB_GetResponse

lContentLength : is this each chunk size or the full size that is request through IWEB_GetResponse

Total length that will be recieved for your request.........

Total length that will be recieved for your request.........

hi all,
after using
pMe->len = ISOURCE_Read(pMe->pISource, pMe->readBuf, READ_BUFFER_SIZE);
I'm getting -2 value as return value.
READ_BUFFER_SIZE is 16384.
if i use same url in web browser like firefox or IE... i'm getting the correct response.
i count tht characters.. the count is ~2000.
wht to do.. plz help me.
thanks in advance.

hi all,
after using
pMe->len = ISOURCE_Read(pMe->pISource, pMe->readBuf, READ_BUFFER_SIZE);
I'm getting -2 value as return value.
READ_BUFFER_SIZE is 16384.
if i use same url in web browser like firefox or IE... i'm getting the correct response.
i count tht characters.. the count is ~2000.
wht to do.. plz help me.
thanks in advance.

-2 is error ISOURCE_WAIT: no data available at the moment; try again later after calling Readable (call Readable() to wait).
See netdiagnostics example shipped with Brew SDK for details on calling Readable/read.

-2 is error ISOURCE_WAIT: no data available at the moment; try again later after calling Readable (call Readable() to wait).
See netdiagnostics example shipped with Brew SDK for details on calling Readable/read.