title: Getting socket timeout when receiving frequent requests at once
body: <p>I attempting to build a remote controller for my laptop using my phone.
  I written a server application that running on my laptop, the remote app used as a client to the server application.
  I want to implement a mouse pad, the problem is when I am moving my finger over the "touch pad" too fast, I am receiving read time out on server side after few iterations.</p>
  
  <blockquote>
    <p>Server code
    final ExecutorService clientProcessingPool = Executors.newFixedThreadPool(20);</p>
  </blockquote>
  
  <pre><code>    Runnable serverTask = new Runnable()
      {
          @Override
          public void run()
          {
              ServerSocket serverSocket = null;
              try
              {
                  serverSocket = new ServerSocket(DEFAULT_PORT);
                  serverSocket.setReuseAddress(true);
                  _working = true;
                  while (_working)
                  {
                      Socket clientSocket = serverSocket.accept();
                      clientSocket.setSoTimeout(10000);
                      clientProcessingPool.submit(new ClientTask(clientSocket));
                  }
              }
              catch (IOException e)
              {
                  System.err.println("Unable to process client request");
                  e.printStackTrace();
              }
              finally
              {
                  try
                  {
                      if (serverSocket != null)
                      {
                          serverSocket.close();
                      }
                  }
                  catch (IOException e)
                  {
                      e.printStackTrace();
                  }
              }
          }
      };
      Thread serverThread = new Thread(serverTask);
      serverThread.start();
  
  private class ClientTask implements Runnable
  {
      private final Socket    clientSocket;
  
      private ClientTask(Socket clientSocket)
      {
          this.clientSocket = clientSocket;
      }
  
      @Override
      public void run()
      {
          System.out.println("Got a client !");
          try
          {
              System.out.println("Connected!");
              DataOutputStream dOut = new DataOutputStream(clientSocket.getOutputStream());
              DataInputStream dIn = new DataInputStream(clientSocket.getInputStream());
  
              String request = dIn.readUTF();
              parseRequest(request);
              System.out.println("request=" + request);
  
              dOut.writeUTF("Got the command");
              dOut.flush(); // Send off the data
  
              dIn.close();
              dOut.close();
  
              clientSocket.close();
          }
          catch (Exception e)
          {
              e.printStackTrace();
          }
      }
  </code></pre>
  
  <p>I thought maybe I will send the requests only if the distance from the starting position to end position is bigger than STEPS(a constant) and only then send the request. But I think the mouse won`t move fluidly.    </p>
  
  <p>Thanks.</p>