File tree Expand file tree Collapse file tree 2 files changed +7
-13
lines changed
examples/AdvancedChatServer Expand file tree Collapse file tree 2 files changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ class EthernetClient : public Client {
2525 virtual uint8_t connected ();
2626 virtual operator bool ();
2727 virtual bool operator ==(const EthernetClient&);
28+ virtual bool operator !=(const EthernetClient& rhs) { return !this ->operator ==(rhs); };
2829
2930 friend class EthernetServer ;
3031
Original file line number Diff line number Diff line change @@ -75,22 +75,15 @@ void loop() {
7575 for (byte i=0 ;i<4 ;i++) {
7676 if (!clients[i] && clients[i]!=client) {
7777 clients[i] = client;
78+ // clead out the input buffer:
79+ client.flush ();
80+ Serial.println (" We have a new client" );
81+ client.print (" Hello, client number: " );
82+ client.print (i);
83+ client.println ();
7884 break ;
7985 }
8086 }
81-
82- // clead out the input buffer:
83- client.flush ();
84- Serial.println (" We have a new client" );
85- client.println (" Hello, client!" );
86- client.print (" my IP: " );
87- client.println (Ethernet.localIP ());
88- client.print (" my port: " );
89- client.println (client.localPort ());
90- client.print (" your IP: " );
91- client.println (client.remoteIP ());
92- client.print (" your port: " );
93- client.println (client.remotePort ());
9487 }
9588
9689 if (client.available () > 0 ) {
You can’t perform that action at this time.
0 commit comments