Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Running IdTcpclient with Thread


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 2 - Last Post: Nov 28, 2017 10:09 AM Last Post By: madammar ellias
madammar ellias

Posts: 111
Registered: 8/17/17
Running IdTcpclient with Thread  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 27, 2017 7:06 PM
i try to rebuild a client and server from scratch by following remy suggestions in the following threads

https://forums.embarcadero.com/thread.jspa?threadID=260918&tstart=0

now i am running this client Thread and every thing is fine until i go to background / Foreground

if i am in app foreground i receive data normally , if i send the app to background for a minute and bring back the app to foreground all reads from server is delayed and arrived suddenly all together

what could be the problem ?
is it a threading problem ?
or something with idtcpclient ?
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Running IdTcpclient with Thread  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 28, 2017 9:45 AM   in response to: madammar ellias in response to: madammar ellias
madammar ellias wrote:

if i am in app foreground i receive data normally , if i send the app
to background for a minute and bring back the app to foreground all
reads from server is delayed and arrived suddenly all together

When an app is put into the background, its priority drops, and Android
is free to suspend it, or even kill it, at any time. Typically, if you
have a long-running task that needs to run in the background even when
the user is not interacting with the app, consider moving the task to a
worker thread inside of a service.

--
Remy Lebeau (TeamB)
madammar ellias

Posts: 111
Registered: 8/17/17
Re: Running IdTcpclient with Thread  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 28, 2017 10:04 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy Lebeau (TeamB) wrote:
consider moving the task to a
worker thread inside of a service.

--
Remy Lebeau (TeamB)

i have tried to run the whole connection Thread into android LOCAL service before , things i have faced

synchronize isn't actually fired in android service on other hand i cannot notify the main Host application to update some data when its needed from android local service .

i looked into Thread policy and priority setting them does not change any thing

Edited by: madammar ellias on Nov 28, 2017 10:05 AM

Edited by: madammar ellias on Nov 28, 2017 10:09 AM
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02