title: How to implement PUSH Mechanism in Asynchronous Client/Socket programming in JAVA?
body: <p>I have a simple serversocket program ( Both client and server).
  Now,for continuous data receive and transfer, I have a while(true){}  (<strong><em>Infinite Loop</em></strong>) in both my Client and Server.</p>
  
  <hr>
  
  <blockquote>
    <p><strong>Is there is a way to replace this infinite loop with anything that
    accepts or sends data when only data is available?</strong></p>
  </blockquote>
  
  <hr>
  
  <blockquote>
    <p>That means for example, my Client needs to send data to the Sever only
    when data is available. Similarly my Server needs to receive data only
    when the Client sends data. This <strong>shouldn't</strong> be implemented in a
    <strong><em>infinite loop</em></strong> but has to be <strong><em>continuously</em></strong> transfer and receive data.</p>
  </blockquote>