File tree 4 files changed +15
-5
lines changed
4 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ void loop() {
34
34
delay (1000 );
35
35
Serial.printf (" --loop %d\n " , ++i);
36
36
delay (10 );
37
- WiFiClient client = server.available ();
37
+ WiFiClient client = server.accept ();
38
38
if (!client) {
39
39
return ;
40
40
}
Original file line number Diff line number Diff line change @@ -163,10 +163,18 @@ void WiFiServer::close() {
163
163
_listen_pcb = nullptr ;
164
164
}
165
165
166
+ void WiFiServer::end () {
167
+ close ();
168
+ }
169
+
166
170
void WiFiServer::stop () {
167
171
close ();
168
172
}
169
173
174
+ WiFiServer::operator bool () {
175
+ return (status () != CLOSED);
176
+ }
177
+
170
178
template <typename T>
171
179
T* slist_append_tail (T* head, T* item) {
172
180
if (!head) {
Original file line number Diff line number Diff line change @@ -75,10 +75,10 @@ class WiFiServer {
75
75
76
76
public:
77
77
WiFiServer (const IPAddress& addr, uint16_t port);
78
- WiFiServer (uint16_t port);
78
+ WiFiServer (uint16_t port = 23 );
79
79
virtual ~WiFiServer () {}
80
80
WiFiClient accept (); // https://www.arduino.cc/en/Reference/EthernetServerAccept
81
- WiFiClient available (uint8_t * status = nullptr );
81
+ WiFiClient available (uint8_t * status = nullptr ) __attribute__((deprecated( " Use accept(). " ))) ;
82
82
83
83
bool hasClient ();
84
84
// hasClientData():
@@ -95,8 +95,10 @@ class WiFiServer {
95
95
bool getNoDelay ();
96
96
uint8_t status ();
97
97
uint16_t port () const ;
98
+ void end ();
98
99
void close ();
99
100
void stop ();
101
+ explicit operator bool ();
100
102
101
103
using ClientType = WiFiClient;
102
104
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ class WiFiClientSecure;
31
31
class WiFiServerSecure : public WiFiServer {
32
32
public:
33
33
WiFiServerSecure (IPAddress addr, uint16_t port);
34
- WiFiServerSecure (uint16_t port);
34
+ WiFiServerSecure (uint16_t port = 22 );
35
35
WiFiServerSecure (const WiFiServerSecure &rhs);
36
36
virtual ~WiFiServerSecure ();
37
37
@@ -65,7 +65,7 @@ class WiFiServerSecure : public WiFiServer {
65
65
66
66
// If awaiting connection available and authenticated (i.e. client cert), return it.
67
67
WiFiClientSecure accept (); // https://www.arduino.cc/en/Reference/EthernetServerAccept
68
- WiFiClientSecure available (uint8_t * status = nullptr );
68
+ WiFiClientSecure available (uint8_t * status = nullptr ) __attribute__((deprecated( " Use accept(). " ))) ;
69
69
70
70
WiFiServerSecure& operator =(const WiFiServerSecure&) = default ;
71
71
You can’t perform that action at this time.
0 commit comments