content-length in http , depends on what ?


I have a mobile application that downloads some data from web-server database , it was working fine with the mobile 6610 before from same place, but now it is not working properly !,
 
- What happenned is, when I get the data using the php code resides in my server it was not returning the "length" of the packet , but now it is returning the length ( using http.getLength() method in java, normally was returing -1 , but now returning 93 for some strange reason !!! )  can yopu help me please what could be happenning ?!, returning or not returning the packet length depends on what ?

- Also I tried to handle the data reception when length is available, but something is still wrong
herein the code
      if( len != -1) {      debug="6";
             for(int i =0 ; i < len ; i++ ){
                   ch = iStrm.read();
                   bStrm.write(ch);      debug="7"; //it stops here !
              if (ch == 10) { // incase length is available, no detection of ch==10 or 13
                        vStr.addElement(bStrm.toString());
                                  bStrm.reset();
                       }
      }
      }
            else
            while ( (ch = iStrm.read()) != -1) {
                    bStrm.write(ch);
                  if (ch == 10) {
                    vStr.addElement(bStrm.toString());
                    bStrm.reset();
            }
      } // while


- one important point is why the length always returning 93 even if the data is more , I know in http it comes in chunks , but not chunks of 93 bytes !


thanks very much for your help !
LVL 1
khamoudaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

petmagdyCommented:
please i don't understand, what changed in the application to become not working, the device or the Web components?
0
khamoudaAuthor Commented:

I am not sure actually, I even posted a question to my web hosting company if they have changed any thing !. Actually the application is working fine with some mobiles ( latest mobiles ) but with nokia 6610 & 6220 it was working fine , but now it is not !!!, in 6220 I got an exception :missing CRLF  ( I think it means carriage return line feed ) , this is why I tried to change the line if ( ch == 10 ) to ch== 13 or both , but still some thing has been changed in the received data format

thanks
0
petmagdyCommented:
ok take care that 6610 and 6220 is series 30 or 40 they are limited to 64 K RAM only!! so probably if the return HTML is very long it will not work, concentrate on Series 60 mobiles like 3650, 3660
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

khamoudaAuthor Commented:
can you comment on this :

but now it is returning the length ( using http.getLength() method in java, normally was returing -1 , but now returning 93 for some strange reason !!! )  can yopu help me please what could be happenning ?!, returning or not returning the packet length depends on what ?
0
petmagdyCommented:
one more question r u using MIDP 1.0 or 2.0?
0
petmagdyCommented:
try to search for ur problem at:

http://www.forum.nokia.com/main.html

specify in ur search the nokia model has the problem
0
CEHJCommented:
A client application should not rely on the content length being provided. It should simply read until EOF
0
khamoudaAuthor Commented:

the problem actually with the midp1. Reading until the EOF ( -1 )  could not finish if the length is indicated, I read it somewhere

0
CEHJCommented:
>>could not finish if the length is indicated

I find that hard to believe. I don't normally deal with J2ME. Can you post a link to the API docs?
0
petmagdyCommented:
khamouda
This is a device specific problem u need to return to the manifacturer site to see if this problem is reported and what to do about it, if it is not fixed concentrate on the devices that works.

I saw even worth cases while I was developing J2ME products different devices and vendors and series and models is a big miss u must focus on the reliable devices for ur application and the devices u r mentioning that has the problem is not suitable for applications that deal with networks it is only 64 K RAM
0
petmagdyCommented:
Hi Venabili

My advice was quite correct, because I worked on J2ME devices before and I know (and faced actually) that the mentioned problem can be device specific, means specific for the mobile model used
0
khamoudaAuthor Commented:

please magdy can u help in this question http://www.experts-exchange.com/Programming/Wireless_Programming/Q_21199559.html

is their any WAP APto be used in J2ME ,  I I think it is a good idea to write one !

khaled
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.