@@ -69,33 +69,33 @@ void loop() {
69
69
for (byte i=0 ;i<4 ;i++) {
70
70
if (!clients[i] && clients[i]!=client) {
71
71
clients[i] = client;
72
+ // clead out the input buffer:
73
+ client.flush ();
74
+ // clead out the input buffer:
75
+ client.flush ();
76
+ Serial.println (" We have a new client" );
77
+ client.println (" Hello, client!" );
78
+ client.print (" my IP: " );
79
+ client.println (Ethernet.localIP ());
80
+ client.print (" my port: " );
81
+ client.println (client.localPort ());
82
+ client.print (" your IP: " );
83
+ client.println (client.remoteIP ());
84
+ client.print (" your port: " );
85
+ client.println (client.remotePort ());
72
86
break ;
73
87
}
74
88
}
75
-
76
- // clead out the input buffer:
77
- client.flush ();
78
- Serial.println (" We have a new client" );
79
- client.println (" Hello, client!" );
80
- client.print (" my IP: " );
81
- client.println (Ethernet.localIP ());
82
- client.print (" my port: " );
83
- client.println (client.localPort ());
84
- client.print (" your IP: " );
85
- client.println (client.remoteIP ());
86
- client.print (" your port: " );
87
- client.println (client.remotePort ());
88
89
}
89
90
90
91
if (client.available () > 0 ) {
91
92
// read the bytes incoming from the client:
92
93
char thisChar = client.read ();
93
94
// echo the bytes back to all other connected clients:
94
95
for (byte i=0 ;i<4 ;i++) {
95
- if (! clients[i] || ( clients[i]== client) ) {
96
- continue ;
96
+ if (clients[i] && clients[i]!= client) {
97
+ clients[i]. write (thisChar) ;
97
98
}
98
- clients[i].write (thisChar);
99
99
}
100
100
// echo the bytes to the server as well:
101
101
Serial.write (thisChar);
0 commit comments