File tree 2 files changed +7
-13
lines changed
examples/AdvancedChatServer
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 {
25
25
virtual uint8_t connected ();
26
26
virtual operator bool ();
27
27
virtual bool operator ==(const EthernetClient&);
28
+ virtual bool operator !=(const EthernetClient& rhs) { return !this ->operator ==(rhs); };
28
29
29
30
friend class EthernetServer ;
30
31
Original file line number Diff line number Diff line change @@ -75,22 +75,15 @@ void loop() {
75
75
for (byte i=0 ;i<4 ;i++) {
76
76
if (!clients[i] && clients[i]!=client) {
77
77
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 ();
78
84
break ;
79
85
}
80
86
}
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 ());
94
87
}
95
88
96
89
if (client.available () > 0 ) {
You can’t perform that action at this time.
0 commit comments