You Are Here:

Community: Developer Discussion Boards

#1 Old Threading:variable time in getting data from server - 2009-02-17, 16:17

Join Date: Feb 2009
Posts: 12
jaakkie
Offline
Registered User
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.
Reply With Quote

#2 Old Re: Threading:variable time in getting data from server - 2009-02-17, 17:02

Join Date: Jun 2003
Posts: 4,325
Location: Cheshire, UK
grahamhughes's Avatar
grahamhughes
Offline
Forum Nokia Champion
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.
Reply With Quote

#3 Old Re: Threading:variable time in getting data from server - 2009-02-18, 05:48

Join Date: Feb 2009
Posts: 12
jaakkie
Offline
Registered User
There are two threads one for animation and one for connection.
Reply With Quote

#4 Old Re: Threading:variable time in getting data from server - 2009-02-18, 05:58

Join Date: Mar 2008
Posts: 2,161
Location: The Capital of I N D I A
Send a message via Skype™ to raj_J2ME
raj_J2ME's Avatar
raj_J2ME
Offline
Forum Nokia Champion
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

R a j - The K e r n e l
Reply With Quote

#5 Old Re: Threading:variable time in getting data from server - 2009-02-18, 11:42

Join Date: Jun 2003
Posts: 4,325
Location: Cheshire, UK
grahamhughes's Avatar
grahamhughes
Offline
Forum Nokia Champion
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.
Reply With Quote

#6 Old Re: Threading:variable time in getting data from server - 2009-02-18, 12:16

Join Date: Feb 2009
Posts: 12
jaakkie
Offline
Registered User
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
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

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

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
login dialog send to server and retrieve data from server samsee Python 4 2008-12-13 18:37
J2ME encrypt C# decrypt josual Mobile Java Networking & Messaging & Security 13 2008-10-20 05:29
Socket : server gets data only when I exit client app viku_006 Mobile Java Networking & Messaging & Security 4 2007-06-25 13:26
6600 gprs 发送大量rtp延时问题 dicson_hu Symbian 9 2005-11-04 03:12
Clarifications on User Data, User Data Binary and User Data Header saijee General Messaging 2 2004-09-15 23:47

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia