Android - BroadcastReceiver inside a thread
<p>Is it possible to have broadcastReceiver running inside a thread (just broadcastReceiver)? As far as I know, this can't be done unless there is a way to keep the thread alive (even tough there is no work). Please correct me if I'm wrong.</p>

<p>This is what I want to do: I have a client and a server program that run without knowing when anyone of them will be ready. The client will keep trying to send a request to the server while at the same time monitoring a reply from the server. Upon receiving a reply from the server, that means the server is online. </p>

<p>I have tried to use thread (on the client) to keep sending a request to the server with a periodical sleep. And then have the client main thread  to do a while loop with a periodical sleep (hoping to catch a reply when there is a broadcast from the server). Unfortunately, this does not work. </p>

<p>The client extra thread has been verified to send a request, the server has send a reply, but for some reason the client main thread does not receive anything. Implementation of the broadcastreceiver on both server and client have been verified to work, so that's not the issue.</p>

<p>Anyone has a better solution/approach for this problem? </p>
