title: WiFiClient.Read() returns number 1 for each character sent
body: <p>I am trying to send data to an ESP32 using TCP. The program is written in the Arduino IDE. For sending the data I am using an app called Packet Sender. The program should print the data to Serial and also back to the WiFiClient.</p>
  <p>Whenever I send data to the ESP32 it prints '1' for each byte sent. The message &quot;Received data&quot; is sent correctly.</p>
  <p>I am using this code:</p>
  <pre><code>#include &lt;WiFi.h&gt;
  
  const uint ServerPort = 23;
  WiFiServer Server(ServerPort);
  WiFiClient RemoteClient;
  
  const char *SSID = &quot;SSID&quot;;
  const char *WiFiPassword = &quot;Password&quot;;
  
  void ConnectToWifi()
  {
    WiFi.mode(WIFI_STA);
    WiFi.begin(SSID, WiFiPassword);
    Serial.print(&quot;Connecting to &quot;); Serial.println(SSID);
   
    uint8_t i = 0;
    while (WiFi.status() != WL_CONNECTED)
    {
      Serial.print('.');
      delay(500);
   
      if ((++i % 16) == 0)
      {
        Serial.println(F(&quot; still trying to connect&quot;));
      }
    }
   
    Serial.print(F(&quot;Connected. My IP address is: &quot;));
    Serial.println(WiFi.localIP());
  }
  
  void CheckForConnections()
  {
    if (Server.hasClient())
    {
      Serial.println(&quot;Client spoted&quot;); 
      if (RemoteClient.connected())
      {
        Serial.println(&quot;Connection rejected&quot;);
        Server.available().stop();
      }
      else
      {
        Serial.println(&quot;Connection accepted&quot;);
        RemoteClient = Server.available();
      }
    }
  }
  
  void setup() {
    Serial.begin(9600);
   
    ConnectToWifi();
    
    Server.begin();
  }
  
  void loop() {
   // RemoteClient = Server.available();
   CheckForConnections();
    if(RemoteClient)
    {
      uint8_t ch;
      bool newDataReceived = false;
  
      while(ch = RemoteClient.read() != -1 ){
        Serial.print(ch);
        RemoteClient.write(ch);
        newDataReceived = true;
      }
      if(newDataReceived){
        Serial.println();
        RemoteClient.print(&quot;Received data&quot;);
      } 
    }
  }
  </code></pre>