Hello
I am working with an arduino Mega with an Ethernet Shield.
Here is a very basic sketch:
#include <Ethernet2.h>
byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
IPAddress ip(192, 168, 0, 177);
IPAddress gateway(192, 168, 0, 254);
IPAddress subnet(255, 255, 255, 0);
EthernetServer server(2000);
void setup()
{
Ethernet.begin(mac, ip, gateway, subnet);
server.begin();
Serial.println(Ethernet.localIP());
}
int cpt=0;
void loop()
{
cpt ++;
if (cpt>10)
{
server.println("notification" + String(random(1,100)));
cpt=0;
}
delay(200);
}
I am trying to connect multiple clients (from a PC with telnet command) to this arduino. This works great: Each clients receive a notification message each 2 seconds.
What i want to do is to get a "list" of all connected clients. There is no "clients" property on server object.
So my question is: How can i get a list of connected clients ?
And second question: This sample code is taken from an example program: the mac address is not the real mac address of my hardware component. Is there a way for the sketch to ask real mac address instead of hard coding it ?
Thanks