diff --git a/libraries/Ethernet/EthernetClient.h b/libraries/Ethernet/EthernetClient.h index e2037c3b2..1992db052 100644 --- a/libraries/Ethernet/EthernetClient.h +++ b/libraries/Ethernet/EthernetClient.h @@ -25,6 +25,7 @@ public: virtual uint8_t connected(); virtual operator bool(); virtual bool operator==(const EthernetClient&); + virtual bool operator!=(const EthernetClient& rhs) { return !this->operator==(rhs); }; friend class EthernetServer; diff --git a/libraries/Ethernet/examples/AdvancedChatServer/AdvancedChatServer.ino b/libraries/Ethernet/examples/AdvancedChatServer/AdvancedChatServer.ino index 879052a94..6fa2787e0 100644 --- a/libraries/Ethernet/examples/AdvancedChatServer/AdvancedChatServer.ino +++ b/libraries/Ethernet/examples/AdvancedChatServer/AdvancedChatServer.ino @@ -75,22 +75,15 @@ void loop() { for (byte i=0;i<4;i++) { if (!clients[i] && clients[i]!=client) { clients[i] = client; + // clead out the input buffer: + client.flush(); + Serial.println("We have a new client"); + client.print("Hello, client number: "); + client.print(i); + client.println(); break; } } - - // clead out the input buffer: - client.flush(); - Serial.println("We have a new client"); - client.println("Hello, client!"); - client.print("my IP: "); - client.println(Ethernet.localIP()); - client.print("my port: "); - client.println(client.localPort()); - client.print("your IP: "); - client.println(client.remoteIP()); - client.print("your port: "); - client.println(client.remotePort()); } if (client.available() > 0) {