×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    12

    Threading:variable time in getting data from server

    hi ,

    i am in the middle of developing an application which fetches data from server
    and displays it.I am using low level api for graphics.ie using canvas class.
    Issue:
    when i have to call a web service i start a thread.on run method i paint the
    screen in a rectangle with a line moving to and fro .
    in the background thread i fetch data from the server.
    the problem occurs when the data takes time to be fetched from the server.
    the moving line stops,while the data takes more time.

    solution i need:
    i need the line to move to and fro till i receive data.
    even if it is for 1 sec or for 2 minutes.
    after that i need to fix a limit so that if the data has not been fetched in a stipulated time lets say 3minutes i need to give a message of "connection timed" out and "retry" message.

    steps tried:
    increase the time duration of the thread.still painting stops(to and fro motion stops) and
    after getting sought of stuck for some time the data is then retrieved.

    what the problem might be:
    when one thread(background for fetching data) is stuck(taking time).the other thread also stops.
    ie it is sought of synchronous.

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Threading:variable time in getting data from server

    How many threads do you create? Just one? Or two: one for the connection and one for the animation?

    What device are you using?

    Cheers,
    Graham.

  3. #3
    Registered User
    Join Date
    Feb 2009
    Posts
    12

    Re: Threading:variable time in getting data from server

    There are two threads one for animation and one for connection.

  4. #4
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: Threading:variable time in getting data from server

    Hi,
    For the connection time out you can store the time at the time of the connection starting...then keep on check the time in loop (run())..as soon as the current time reached equal or greater then 3 min then set the connection time out and then handle the keypressed...
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  5. #5
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Threading:variable time in getting data from server

    Some actions do cause all threads to stop, depending on the device. For example, accessing RMS.

    What quantity of data are you receiving? Over what kind of connection? On what device?

    Cheers,
    Graham.

  6. #6
    Registered User
    Join Date
    Feb 2009
    Posts
    12

    Re: Threading:variable time in getting data from server

    i am connecting to a web service through stubs .
    i am using CLDC.size is variable.i am getting pics one at a time,
    and its few details.

    with regards

Similar Threads

  1. Replies: 4
    Last Post: 2008-12-13, 17:37
  2. J2ME encrypt C# decrypt
    By josual in forum Mobile Java Networking & Messaging & Security
    Replies: 13
    Last Post: 2008-10-20, 04:29
  3. Socket : server gets data only when I exit client app
    By viku_006 in forum Mobile Java Networking & Messaging & Security
    Replies: 4
    Last Post: 2007-06-25, 12:26
  4. Replies: 2
    Last Post: 2004-09-15, 22:47

Posting Permissions

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