title: Resetting the InputStream of a Java Socket after reaching EOS
body: <p>I'm attempting to connect two separate applications via a TCP/IP socket. In this case neither of the applications is running as a "client" of the other, it would be easier to describe them as two separate servers who need to communicate with each other.</p>
  
  <p>To receive the data I'm using the <code>InputStream.Read()</code> function and once it receives a value of <code>-1</code> it should stop processing. However, now the problem is that if another set of data comes along the <code>InputStream</code> is already at the End of Stream (<code>EOS</code>) and so all new data being sent is discarded or ignored. The only way I have found to fix this problem is that once the End of Stream has been reached I close the socket and reopen it which I think might be handled better some other way.</p>
  
  <p>How can I reset the InputStream so that it is ready for the next set of data that may come along?</p>