#include<SPI.h>#include<Ethernet.h>bytemac[]={0xDE,0xAD,0xBE,0xEF,0xFE,0xED};IPAddressip(192,168,69,104);// telnet defaults to port 23
EthernetServerserver(23);EthernetClientclients[8];voidsetup(){Ethernet.begin(mac,ip);// Open serial communications and wait for port to open:
Serial.begin(9600);while(!Serial){;// wait for serial port to connect. Needed for native USB port only
}// start listening for clients
server.begin();}voidloop(){// check for any new client connecting, and say hello (before any incoming data)
EthernetClientnewClient=server.accept();if(newClient){for(bytei=0;i<8;i++){if(!clients[i]){newClient.print("Hello, client number: ");newClient.println(i);// Once we "accept", the client is no longer tracked by EthernetServer
// so we must store it into our list of clients
clients[i]=newClient;break;}}}// check for incoming data from all clients
for(bytei=0;i<8;i++){while(clients[i]&&clients[i].available()>0){// read incoming data from the client
Serial.write(clients[i].read());}}// stop any clients which disconnect
for(bytei=0;i<8;i++){if(clients[i]&&!clients[i].connected()){clients[i].stop();}}}