title: ESP32 board_POST_Error_[E][WiFiClient.cpp:258] connect(): socket error on fd 56, errno: 113, "Software caused connection abort"
body: <p>I need to send HTTP POST request using ESP32 module, to my REST API server which coded using python. But when running following code, an error comes. Running on Windows 10 OS. WiFi is connecting with the module. here I need to send &quot;A&quot; to the REST API server.</p>
  <p>Code - Running on VSCode PlatformIO IDE.</p>
  <pre><code>#include &lt;Arduino.h&gt;
  #include &lt;WiFi.h&gt;
  #include &lt;HTTPClient.h&gt;
  #include &lt;Arduino_JSON.h&gt;
  
  const char *ssid = &quot;***need to fill***&quot;;
  const char *password = &quot;***need to fill***&quot;;
  
  const char *serverName = &quot;***need to fill***&quot;;
  String sensorReadings;
  
  String httpGETRequest(const char *serverName);
  
  void setup()
  {
     Serial.begin(115200);
  WiFi.begin(ssid, password);
  Serial.print(&quot;Connecting to WiFi ..&quot;);
  while (WiFi.status() != WL_CONNECTED)
  {
    Serial.print('.');
  delay(1000);
  }
  Serial.println(WiFi.localIP());
  }
  
  void loop()
  {
   //Check WiFi connection status
  if (WiFi.status() == WL_CONNECTED)
  {
  sensorReadings = httpGETRequest(serverName);
  Serial.println(sensorReadings);
  JSONVar myObject = JSON.parse(sensorReadings);
  
  // JSON.typeof(jsonVar) can be used to get the type of the var
  if (JSON.typeof(myObject) == &quot;undefined&quot;)
  {
    Serial.println(&quot;Parsing input failed!&quot;);
    return;
  }
  
  Serial.print(&quot;JSON object = &quot;);
  Serial.println(myObject);
  
  // myObject.keys() can be used to get an array of all the keys in the object
  JSONVar keys = myObject.keys();
  
  for (int i = 0; i &lt; keys.length(); i++)
  {
    JSONVar value = myObject[keys[i]];
    Serial.print(keys[i]);
    Serial.print(&quot; = &quot;);
    Serial.println(value);
  }
  }
  else
  {
  Serial.println(&quot;WiFi Disconnected&quot;);
  }
  delay(2000);
  }
  
  String httpGETRequest(const char *serverName)
  {
  WiFiClient client;
  HTTPClient http;
  
   // Your Domain name with URL path or IP address with path
  http.begin(client, serverName);
  http.addHeader(&quot;Content-Type&quot;, &quot;application/json&quot;);
  
   // Reading one byte from serial buffer
   uint8_t buffer;
   Serial.readBytes(&amp;buffer, 1);
  
    // Dummy data to check
    // this is the hex value for
    // 'A' = 0x41
    buffer = 0x41;
  
   // creating payload buff
    char buff[100];
    sprintf(buff, &quot;{\&quot;Serial_Data\&quot;: \&quot;%c\&quot;}&quot;, buffer);
  
   // Send HTTP POST request
   int httpResponseCode = http.POST(buff);
   String payload = &quot;{}&quot;;
  
   if (httpResponseCode &gt; 0)
   {
   Serial.print(&quot;HTTP Response code: &quot;);
   Serial.println(httpResponseCode);
   payload = http.getString();
   }
    else
   {
    Serial.print(&quot;Error code: &quot;);
    Serial.println(httpResponseCode);
   }
    // Free resources
   http.end();
  
    return payload;
    }  
  </code></pre>
  <p>Error comes as below,</p>
  <pre><code> [E][WiFiClient.cpp:258] connect(): socket error on fd 54, errno: 113, &quot;Software caused 
   connection abort&quot;
   Error code: -1
   {}
   JSON object = {}
  </code></pre>