title: long polling using java-sockets
body: <p>I have developed a java based-client that makes a connection to a server using Java-sockets. For information-exchange I used http-Protocol. Basically, I make a connection via a socket and I wrote a method on client side that makes http-requests to the server. The Server, to which I am connecting is a very simple server that I developed by my self.I want to ask, whether it is possible to make a long polling using request-method via sockets. </p>
  
  <p>Since I have a request-method in my class client, I have two Options:
  <strong>a continuous request:</strong> consists in sending each millisecond a request asking, whether a new event occured. <strong>A prolonged request</strong> (called long polling): client send a request. The Server will answer, if it has the response. Otherwise it will not send a response and the request will time out. At that time the client send a new request</p>
  
  <p>Here is a description of my model:</p>
  
  <pre><code>I wrote a simple http-client and a simple http-server. 
  *The client has a method request 
  * the server has a method respond.
  *The client send a get-request by using its request-method to my server (gives back a command to the client)
  **That server reponds to this request using its respond-method.  
  </code></pre>
  
  <p>How can I extend my program? 
   How can I implement a long polling using my available client and server?   </p>