title: Multiple threads reading from same socket
body: <p>I am developing an app which displays data from a server. The server is not mine and it is not very stable. Making too many connections crashes the server.</p>
  
  <p>I have one socket to the server in my main activity, but at times I want to open sub activities which read the data and display it. My problem is that I am unable to achieve this with the same socket and have to open a new socket for every activity.
  Every activity has a thread which does the reading from the socket and updates the UI elements on that activity as needed.</p>
  
  <p>To use the same socket in multiple activities, I tried to close the inputReader of an activity before starting the new activity, but that simply make the application hang. If I leave it open, then the new thread in the new activity never receives any data. Killing the thread before starting the new activity is not possible because the thread is generally blocked by the read() function.</p>
  
  <p>Is there anyway that I can have a centralized thread which does the reading and then sends the data to all the other threads in other activities so that I don't have to open new sockets in every activity?</p>
  
  <p>I feel that this is a very basic thing that I am asking, but yet I am unable to find a solution. </p>