WiFiNINA - client.status()

Description

Return Connection status.

Syntax

client.status()

Parameters

  • None

Returns

  • The client connection status

Example

…

void setup() {

  Serial.begin(9600);
  while (!Serial) {
        ;  }
  if (WiFi.status() == WL_NO_MODULE) {
        Serial.println("Communication with WiFi module failed!");
                while (true);
  }

   while (status != WL_CONNECTED) {
        Serial.print("Attempting to connect to SSID: ");
        Serial.println(ssid);
                status = WiFi.begin(ssid, pass);
        delay(10000);
  }
  Serial.println("Connected to WiFi");
  printWifiStatus();

  Serial.println("\nStarting connection to server...");
  IPAddress result;
  int err = WiFi.hostByName(server, result) ;
  if (err == 1) {
        Serial.print("IP address: ");
        Serial.println(result);
  } else {
        Serial.print("Error code: ");
        Serial.println(err);
  }


  if (client.connect(result, 80)) {
        Serial.println("connected to server");
                client.println("GET /search?q=arduino HTTP/1.1");
        client.println("Host: www.google.com");
        client.println("Connection: close");
        client.println();
  }
  Serial.print("status: ");
  Serial.println(client.status());
}

…