Komut
status()
Açıklama
Dönüş Bağlantı durumu.
Sözdizimi
client.status ()
Parametreler
Yok
İadeler
İstemci bağlantı durumu
Misal
…
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());
}
…
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());
}
…
Ayrıca bakınız
- Client
- WiFiClient()
- WiFiSSLClient()
- connected()
- connect()
- connectSSL()
- write()
- print()
- println()
- available()
- peek()
- read()
- flush()
- stop()
- remoteIP()
- remotePort()