File tree Expand file tree Collapse file tree 3 files changed +27
-4
lines changed Expand file tree Collapse file tree 3 files changed +27
-4
lines changed Original file line number Diff line number Diff line change 18
18
*/
19
19
20
20
#include " utility/WiFiSocket.h"
21
+ #include " utility/tcp_states.h"
21
22
22
23
#include " WiFi101.h"
23
24
#include " WiFiClient.h"
@@ -190,8 +191,9 @@ uint8_t WiFiClient::connected()
190
191
191
192
uint8_t WiFiClient::status ()
192
193
{
193
- // Deprecated.
194
- return 0 ;
194
+ if (_socket != -1 && WiFiSocket.connected (_socket))
195
+ return ESTABLISHED;
196
+ return CLOSED;
195
197
}
196
198
197
199
WiFiClient::operator bool ()
Original file line number Diff line number Diff line change 18
18
*/
19
19
20
20
#include " utility/WiFiSocket.h"
21
+ #include " utility/tcp_states.h"
21
22
22
23
#include " WiFiClient.h"
23
24
#include " WiFiServer.h"
@@ -102,8 +103,9 @@ WiFiClient WiFiServer::available(uint8_t* status)
102
103
}
103
104
104
105
uint8_t WiFiServer::status () {
105
- // Deprecated.
106
- return 0 ;
106
+ if (_socket != -1 && WiFiSocket.listening (_socket))
107
+ return LISTEN;
108
+ return CLOSED;
107
109
}
108
110
109
111
size_t WiFiServer::write (uint8_t b)
Original file line number Diff line number Diff line change
1
+ #ifndef TCP_STATES_H
2
+ #define TCP_STATES_H
3
+
4
+ // common constants for client.state() return values
5
+ enum tcp_state {
6
+ CLOSED = 0 ,
7
+ LISTEN = 1 ,
8
+ SYN_SENT = 2 ,
9
+ SYN_RCVD = 3 ,
10
+ ESTABLISHED = 4 ,
11
+ FIN_WAIT_1 = 5 ,
12
+ FIN_WAIT_2 = 6 ,
13
+ CLOSE_WAIT = 7 ,
14
+ CLOSING = 8 ,
15
+ LAST_ACK = 9 ,
16
+ TIME_WAIT = 10
17
+ };
18
+
19
+ #endif
You can’t perform that action at this time.
0 commit comments