×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Mar 2003
    Location
    Copenhagen, Denmark
    Posts
    18

    HTTPConnection blocks display refreshing (Nokia 7210 series40)

    Hello there fellow developers and Nokia personnel!

    I've discovered an issue that really worries me!

    Heres the scenario:

    I create 2 new threads.
    First thread is a FullCanvas that displays a simple animation indicating the phone is busy working.

    Second thread establishes a HTTPConnection and posts/downloads content.

    During runtime the animation thread is started followed by the HTTP thread.
    The first frame of the animation screen is displayed, but as soon as the HTTP thread establishes its connection, the animation screen frezzes and seems not to be allowed repainting until the HTTP thread has finnished and disconnected.

    My question is: How in heaven can the HTTP thread block my animation screen, when both tasks are running in separate threads and thus should NOT interfere with each other NOR the event mechanism that repaints the display.

    Is it really so, that it is impossible to maintain and paint upon the display while communicating on the network?

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Canada
    Posts
    101

    RE: HTTPConnection blocks display refreshing (Nokia 7210 series40)

    Are you calling Thread.yield() at various points of your HTTP thread?

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    8
    hi schm1,

    I also met a similar problem while launching a thread to get Http data. Have you solved this problem or figured out what causes the problem? and could you kindly share it with me ?

    thanks

  4. #4
    Registered User
    Join Date
    Mar 2003
    Posts
    8
    besides, this problem doesn't happen on the 6310i emulator

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    8
    I would like to describe my problem, which is quite similar, in more details:

    I used InputStream::read() to get data from the httpconnection'
    s inputstream. The method will block if there is no data currently available (due to the delay in network or other reasons). However, the problem is , even though I process the httpconnection in another thread with min_priority, the read() method will block ALL other thread in the VM, including UI which causes the phone hangs!

    This happens in 7210/6610. however, in 6310i emulator, that read() method also blocks, but just that thread, not affecting other ones!

    It shouldn't happened in that way. I don't think this situation is so difficult to handle for the MIDP implementation. This will greatly limit the functionality of the programs.

    do you guys have any idea about this?

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

    HTTPConnection blocking

    This is also happening with me on the 7210 Emulator. (I will try the Series 60 & 6310i emulator later) Does anyone know if this happens on the phone itself?

    This is a killer for my application. I am using streaming HTTP with "chunked" output handling. This appears to work fine - I receive chunks of ouput appropriately spaced - over the same HTTP request.

    However this means that I have a long lasting SINGLE Http request outstanding. I read this in another thread and when the InputStream read is blocked, the rest of the application is blocked as well. The Http read will be blocked most of the time.

    Is it possible to use some sort of read with instant/short timeout. Then perhaps I could loop with a delay and/or yield before trying again

  7. #7
    Registered User
    Join Date
    Mar 2003
    Posts
    33
    It looks like http I/O really does block all threads (which of course sucks ! ... Nokia ? ).

    For those experimenting with long running http connections (pseudo streaming) you also need to be aware that in most real cases you will be running through a WAP gateway which adds a while bunch of intrusive behaviour.

  8. #8
    Registered User
    Join Date
    Mar 2003
    Location
    Copenhagen, Denmark
    Posts
    18
    Hi Guys,

    Yes I solved the problem - or at least found out what was causing the phone to Hang. If you attemp to read from an http inputstream when there is no content data available, the phone will freeze. Thus you should always inspect the Content-lenght header and don't attempt to read more bytes than specified.

    If no content-lenght header is provided, you should stop reading as soon as you recieve -1. I've tested this with my animation thread, and it runs smooth without freezing.

    However I've given up upon the Chunked transfer encoding.. If anyone has a working example, I would be very happy if you would share :-)

    /Regards

  9. #9
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    202
    Hi,
    We've seen this problem with the threads blocking using HTTP mode communication. If you change the 7210 SDK over to WAP communcation mode does it work any better?


    Mike
    Nokia Developer Operations

  10. #10
    Registered User
    Join Date
    Mar 2003
    Location
    Copenhagen, Denmark
    Posts
    18
    Hi Mike,

    Thanks for listening.
    This is a problem with the actual device, so changing the network communication mechanism of the Emulator SDK won't make any difference? Or maybe I got you wrong?

    /Jeppe
    Last edited by schm1; 2003-04-01 at 16:51.

  11. #11
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    202
    Jeppe,
    Thanks for letting me know. It seems that you have a viable workaround for it anyway.
    The important thing is that you're able to continue your work.

    Mike

Posting Permissions

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