Hide minor edits - Show changes to markup
Ethernet : Server class
Ethernet : clase Server
Write data to all the clients connected to a server.
server.write(data)
data: the value to write (byte or char)
None
Escribe datos a todos los clientes conectados al servidor.
servidor.write(datos)
datos: el valor a escribir (byte o char)
Nada
// network configuration. gateway and subnet are optional.
// configuración de red, el gateway (puerta de enlace) y la subnet son opcionales.
// telnet defaults to port 23
// telnet utiliza por defecto en el puerto 23
// initialize the ethernet device
// inicializa el dispositivo ethernet
// start listening for clients
// comienza a recibir conexiones
Server class
Ethernet : Server class
server.write(data)
server.write(data)
Server class
Write data to all the clients connected to a server.
server.write(data)
data: the value to write (byte or char)
None
#include <Ethernet.h>
// network configuration. gateway and subnet are optional.
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 10, 0, 0, 177 };
byte gateway[] = { 10, 0, 0, 1 };
byte subnet[] = { 255, 255, 0, 0 };
// telnet defaults to port 23
Server server = Server(23);
void setup()
{
// initialize the ethernet device
Ethernet.begin(mac, ip, gateway, subnet);
// start listening for clients
server.begin();
}
void loop()
{
Client client = server.available();
if (client) {
server.write(client.read());
}
}