×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    10

    Strange HTTP Issues

    Hi to all for serveral days i'm trying to solve this problem without success. The problem occurs only on SERIE60_FP2. When i call the method

    ---->int rc=c.getResponseCode();

    the device, also the emulator, hangs.




    if i delete the code above the device,also the emulator, hangs on

    ---->is = c.openInputStream();


    so every read call hangs-up.


    The same code in other devices and emulators rather than SERIE60_FP2 (I.E. NokiaN70) works great. I've tested on the following real devices:

    1. NokiaN70 OK
    2. Nokia6630 KO V.5.03.08


    and on a lot of emulator (excluding the SERIE60_FP2 emulator all the others works great)

    Here is my source code:


    byte[] GetHttpData(String url) throws IOException{
    ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
    InputStream is = null;
    HttpConnection c = null;
    byte strData[]=null;
    long len = 0 ;
    int ch = 0;
    try {
    c = (HttpConnection)Connector.open(url);
    c.setRequestMethod("GET");
    int rc=c.getResponseCode();
    is = c.openInputStream();
    len =c.getLength();
    if (lunghezzaTotale==-1) {lunghezzaTotale=len;}
    if( len != -1) {
    // Read exactly Content-Length bytes
    for(int i =0 ; i < len ; i++ )
    if((ch = is.read()) != -1) {
    byteStream.write(ch);
    }
    } else {

    //Read until the connection is closed.
    while ((ch = is.read()) != -1) {
    len = is.available() ;
    byteStream.write(ch);
    }
    }
    strData=byteStream.toByteArray();
    }catch (IOException ioex){
    mc.messaggio(ioex.toString(),this.mm,0);
    } finally {
    try {
    if (c != null) c.close();
    if (is!= null) is.close();
    }catch (IOException ioex){
    mc.messaggio(ioex.toString(),this.mm,0);
    }
    return strData;
    }
    }



    The code is invoked by a different thread and i've also tried to put a Thread.sleep(1000) method before communication begin as reported in others thread in forum.

    ANY IDEA????
    Thanks a lot.

  2. #2
    Registered User
    Join Date
    May 2006
    Posts
    17

    Re: Strange HTTP Issues

    hi stefanogalizia,

    welcome to Nokia forum.

    Nokia 6680 and 6630 (updraded version only) will not support InputStream properly.

    http://discussion.forum.nokia.com/fo...putStream+6680 This Thread will help you..

    Regards,

    Satya

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    10

    Re: Strange HTTP Issues

    Quote Originally Posted by l_satyadev
    hi stefanogalizia,

    welcome to Nokia forum.

    Nokia 6680 and 6630 (updraded version only) will not support InputStream properly.

    http://discussion.forum.nokia.com/fo...putStream+6680 This Thread will help you..

    Regards,

    Satya
    Hi l_satyadev, thanks for your response but problem still exist. I've tried to use

    is = c.openDataInputStream();

    instead of

    is = c.openInputStream();

    but application freeze and never return from the openDataInputStream line...
    i don't know what to do... any other idea?

    Thanks a lot

  4. #4
    Regular Contributor
    Join Date
    Aug 2006
    Posts
    307

    Re: Strange HTTP Issues

    Sorry is a stupid question, but are you invoking all your communication code from the running thread or just from a function call? I mean if your communication codes are not running in the thread, then it could be the reason for deadlocks.

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    10

    Re: Strange HTTP Issues

    Quote Originally Posted by axs
    Sorry is a stupid question, but are you invoking all your communication code from the running thread or just from a function call? I mean if your communication codes are not running in the thread, then it could be the reason for deadlocks.

    I've tried both... running in a separate thread and in the main thread (a function call)... both methods not works.

  6. #6
    Registered User
    Join Date
    Mar 2003
    Posts
    10

    Re: Strange HTTP Issues

    any other ideas????? Thx

  7. #7
    Super Contributor
    Join Date
    Dec 2005
    Location
    Europe/Poland/Warsaw
    Posts
    1,697

    Re: Strange HTTP Issues

    hi,

    #1
    what is your response code?
    #2
    can you test behavior with some public domain and simply post which one someone else (say me) could try to recreate?

    thanks,
    regards,
    Peter

  8. #8
    Registered User
    Join Date
    Mar 2003
    Posts
    10

    Re: Strange HTTP Issues

    Quote Originally Posted by peterblazejewicz
    hi,

    #1
    what is your response code?
    #2
    can you test behavior with some public domain and simply post which one someone else (say me) could try to recreate?

    thanks,
    regards,
    Peter
    Hi peter,

    #1 I don't receive response code, just freeze the application even if i try to read the response code
    #2 This is the url which try to connect..You can test if you receive the text stream
    http://www.bresciaonline.it/or4/or?u...le_meteo.meteo

    Let me know

    Thank you.

  9. #9
    Registered User
    Join Date
    Mar 2003
    Posts
    10

    Re: Strange HTTP Issues

    HI to all, thanks for youre responses. I've got the SOLUTION, yeah!

    I just deleted all APN and configured the one i use to connect to internet and everything goes ok. I think theres some bug in the implementation of some JAVA API because after i've deleted some APN when i try to connect phone ASK me to select APN (first this behavior does not occurs).


    Thx to all.

    Stefano

  10. #10
    Registered User
    Join Date
    Mar 2003
    Posts
    33

    Arrow Re: Strange HTTP Issues

    Hi Stefano,
    I've also some strange behaviours when using connections here in Italy.
    It works fine with internet connections but not with wap ones.
    Do you ever tested both for your application ?

  11. #11
    Registered User
    Join Date
    Mar 2003
    Posts
    10

    Re: Strange HTTP Issues

    Yes i've used TIM WAP profile and everything goes right!

  12. #12
    Registered User
    Join Date
    Mar 2003
    Posts
    33

    Re: Strange HTTP Issues

    could you please post the connection routine you are using ?
    I've tested a couple but can't figure out what's wrong because mine works with internet connection but not with wap connection.

  13. #13
    Registered User
    Join Date
    Mar 2003
    Posts
    10

    Re: Strange HTTP Issues

    if you look at the first post in this thread you can see the code..

  14. #14
    Registered User
    Join Date
    Mar 2003
    Posts
    33

    Re: Strange HTTP Issues

    Yes thanks, I've tryed that and I get the same exact problems.
    Actually I've written a little logger and on the internet connection everything works fine but with the NOK9500 I get an exception like:
    "Symbian OS error = -36"
    while with NOK7710 I get:
    "Symbian OS error = - 17210"

    This really s**ks

  15. #15
    Registered User
    Join Date
    Mar 2003
    Posts
    33

    Re: Strange HTTP Issues

    Quote Originally Posted by stefanogalizia
    Yes i've used TIM WAP profile and everything goes right!
    On note: With Vodafone (I haven't tested Tim yet on this) I've changed the Access Point Name to "web.omnitel.it" from the previous "wap.omnitel.it" and everything works, so it's really something related to the apn then.
    I've left all proxy stuff untouched and works.

    Are you really sure you are using the TIM WAP with "wap.tim.it" as APN and not changed to "ibox.tim.it" ?

Similar Threads

  1. Replies: 2
    Last Post: 2006-10-06, 17:24
  2. HTTP Client - Synchronous HTTP POST Calls?
    By symbian_ravi in forum Symbian Networking & Messaging (Closed)
    Replies: 5
    Last Post: 2006-04-16, 11:51
  3. HTTP Communication (MIDP 1.0 required but not implemented?)
    By asphalt_world in forum Mobile Java Networking & Messaging & Security
    Replies: 4
    Last Post: 2005-08-13, 12:02
  4. http connection via a proxy programmatically
    By tiansun in forum Mobile Java General
    Replies: 0
    Last Post: 2005-04-19, 02:47
  5. Strange problem with HTTP and Nokia 3650
    By kiiskinn in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2003-07-18, 23:30

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×