Does this happen using an emulator and local server, or just when using the real device OTA? WAP gateways impose a limit to the maximum chunk size they will permit... 3k sounds a bit small, I think that's about the smallest limit allowed by the specification. It would make sense that the CRLF pair would be missing from the chunk if it's been truncated by the gateway.
The problem only happens in the real device. With the emulator, working with the same server, there are no problems.
I am going to tell in more detail what is happening.
The application tries to read from the server a stream containing a set of records, each of which corresponds to a simbol. Each of these records includes, among other things, the size of the record and an image.
I have been making some additional tests and here are the results:
--- First, I have tried to read all the records with a single http request and I have made tests with several sizes. Only in some cases I obtain an error. Yesterday the application could read without problems until 10kb, but that was not the case other days (as I mentioned, I have had problems with smaller sizes).
The exception obtained here is "arrayIndexOutOfBounds".
--- Afterwards, I tried to read the records with several http requests, limiting the maximum size of each of these requests. I have tried with several limits and stream sizes. The result is quite interesting: if I make "x" requests and I read "y" simbols on each request, I always obtain a "chunk not CRLF terminated " exception in the last simbol of each request!!!
I have added at the end of the last image of the stream an integer, to indicate its final and now aplication is able to read up to 12kb without the exception mentioned, but now I have another problem that I am going to write in another thread....