Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Problem reading the HttpConection response in some devices

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everybody,

I am having a strange problem when trying to read the response of an HTTPConnection object. The scenario is this:

1) App in the cellphone connects via HTTP to a webpage
2) The webpage adds some text to the response
3) The app in the cellphone tries to get all the text embedded in the HTTP Response.

If I try the code using emulators or some devices ( like motorola devices ) everything works perfect, but when trying with a live Sony Ericsson W200i I cannot read more than 57 bytes
of the response. Here is the sample code:



In the emulator the result is 70 bytes total, 40 bytes in the first read and 30 bytes in the second read.
In the real device the result is 70 bytes total too, but 40 bytes in the first read and only 17 bytes in the second read!!!
I've tried a dozen ways of reading the response buffer (in a loop, by chunks, in one step all togheter, etc.) and always read only 57 bytes.
Any idea???

Thanks!
 
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The logic makes sense, if it runs in the simulator but not in the device I think it is a matter for the vendor.
 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To make sure I understand every you tried;

You did try reading from the stream in a while loop, similar to the code below?



If not give it a try.
 
A wop bop a lu bop a womp bam boom! Tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic