Hide minor edits - Show changes to markup
Ethernet : Server class
Ethernet : clase Server
Create a server that listens for incoming connections on the specified port.
Server(port);
port: the port to listen on (int)
None
Crea un servidor que recibe conexiones entrantes en el puerto especificado.
Server(puerto);
puerto: el puerto en el cual escuchar (int)
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 class
Create a server that listens for incoming connections on the specified port.
Server(port);
port: the port to listen on (int)
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());
}
}