Verifying response data from server OR stopping w/out reading data

I am sending a POST request, then I the response, then Serial.write it, but I don’t actually do anything with it at the moment. Is there anything wrong with just ignoring the data and jumping right to client.stop()? I would get rid of both while loops and just stop. Here’s the code with a timeout:

  int connectTime = 0;
  while(client.connected() && (connectTime < 5000)) {
  while(client.available()) {
    char ch =;
//  if (client.connected()) { 
      client.stop();	// DISCONNECT FROM THE SERVER

My second question is for the future if I want to verify that the sever received the code, I could have it send back a message code, like OK321, then I would have the Arduino look for that string in the response.

First, is this a good method for verification. Second, how do I handle the data without getting int the String trap where memory consumed given that I receive the data char by char?


You really should read the server response and let the server close its end of the connection first, then close your end.