title: TCP socket connection as a service
body: <p>i tried searching a lot and gave up.
  i have a TCP client class which basically connects to server.
  i call this tcp client class from my main activity and using async thread from main activity i run a method in tcp client class and things goes fine.
  i have a another activity which needs to send a message by calling a method in this tcp client class but i am unable to do.
  please help.</p>
  
  <p>i thought of converting my tcp client class as service but in that case i am not sure how to keep the method running which listens for incoming messages.
  please help.</p>
  
  <p>i used this TCP client class and same main activity
  <a href="http://myandroidsolutions.blogspot.pt/2012/07/android-tcp-connection-tutorial.html" rel="nofollow">http://myandroidsolutions.blogspot.pt/2012/07/android-tcp-connection-tutorial.html</a></p>
  
  <p>also i have to include the functionlity of sending images through this TCP.</p>