code: int receive(byte[] b, int offset, int length) throws IOException, InterruptedException {
  
      synchronized (readLock) {
        if (remaining > 0) {
          int bytesToRead = Math.min(remaining, length);
          int result = stdin.read(b, offset, bytesToRead);
          remaining -= result;
          return result;
        }
        if (eof) {
          return -1;
        }
      }
  
      // make client know we want more data!
      sendSendInput();
  
      synchronized (readLock) {
        if (remaining == 0 && !eof) {
          readLock.wait();
        }
  
        // at this point we should have data so call itself recursively to utilize
        // reentrant lock
        return receive(b, offset, length);
      }
    }
docs: Read data from client's stdin. This function blocks till input is received from the client.
  
  @return number of bytes read or -1 if no more data is available
  @throws IOException in case of socket error