Android, TCP, Servlet -- To and Fro communication without external libraries. What are the standard efficient ways to do it?
<p><strong>What I am trying to build here looks something like this.</strong></p>

<pre><code>MyClients(Multiple) &lt;------&gt; Server(Me) &lt;------&gt; TheirClients(multiple, live)
</code></pre>

<ul>
<li><p><strong>MyClient1</strong> (HTML)</p>

<p><strong>Through Server (HTML -> Servlet -> Android)</strong></p>

<ul>
<li>HisClient1 (uses <code>Android</code> app)(monitored live by MyClient1)</li>
<li>HisClient2 (uses <code>Android</code> app)(monitored live by MyClient1)</li>
<li><strong>...</strong></li>
</ul></li>
<li><strong>...</strong></li>
</ul>

<p><strong>The flow:</strong> (Can have multiple <code>MyClients</code> and <code>HisClints</code> online at the same time)</p>

<ul>
<li><p>MyClient comes online.</p></li>
<li><p>Timely pinging HisClients get connected to the Server.</p></li>
<li><p>MyClient gets notified.</p></li>
<li><p>MyClient sends request to HisClient through server.</p></li>
<li><p>HisClient replies through Server.</p></li>
<li><p>MyClient is updated.</p></li>
</ul>

<p>On the <code>HisClient</code> end i.e. <code>Android</code>, I'm running <code>TCP Socket()</code> to timely ping the server and stay alive. Cannot use <code>URLConnection</code> as the client have to stay alive all the time if the server requests something. Also I don't want to use any external library, so <code>GCM</code> is not an option.</p>

<p>On the <code>MyClient</code> side, I first tried using <code>PHP</code> but it is inefficient of handling <strong>multiple live</strong> clients. Then, after some searching I came to know that <code>Servlets</code>  are good in such cases. So I started developing a <code>Servlet</code>. </p>

<p><strong>Now the questions are:</strong></p>

<p>Am I going in the right direction? I mean is there anything better for such a scenario? If yes, <strong>what and how</strong>? I mean what are the APIs and how will it maintain the live traffic?</p>

<p>If no, how do you handle multiple live <code>HisClients</code> with <code>Servlet</code>? I know, here multiple is not a problem but how to keep them <strong>live</strong> and keep updating <code>MyClient</code>?</p>