Komut
write()
Açıklama
Bir sunucuya bağlı tüm istemcilere veri yazın.
Sözdizimi
server .write (veri)
Parametreler
data : yazılacak değer (bayt veya karakter)
İadeler
bayt : yazılan bayt sayısı. Bunu okumak gerekli değil.
Misal
#include <SPI.h>
#include <WiFi101.h>
char ssid[] = "yourNetwork";
char pass[] = "yourPassword";
int status = WL_IDLE_STATUS;
WiFiServer server(80);
void setup() {
// initialize serial:
Serial.begin(9600);
Serial.println("Attempting to connect to WPA network...");
Serial.print("SSID: ");
Serial.println(ssid);
status = WiFi.begin(ssid, pass);
if ( status != WL_CONNECTED) {
Serial.println("Couldn't get a wifi connection");
while(true);
}
else {
server.begin();
}
}
void loop() {
// listen for incoming clients
WiFiClient client = server.available();
if (client == true) {
// read bytes from the incoming client and write them back
// to any clients connected to the server:
server.write(client.read());
}
}
#include <WiFi101.h>
char ssid[] = "yourNetwork";
char pass[] = "yourPassword";
int status = WL_IDLE_STATUS;
WiFiServer server(80);
void setup() {
// initialize serial:
Serial.begin(9600);
Serial.println("Attempting to connect to WPA network...");
Serial.print("SSID: ");
Serial.println(ssid);
status = WiFi.begin(ssid, pass);
if ( status != WL_CONNECTED) {
Serial.println("Couldn't get a wifi connection");
while(true);
}
else {
server.begin();
}
}
void loop() {
// listen for incoming clients
WiFiClient client = server.available();
if (client == true) {
// read bytes from the incoming client and write them back
// to any clients connected to the server:
server.write(client.read());
}
}