File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,40 @@ This must be called before using any network interfaces. Returns ``true`` on suc
8282 Network.begin(); // Initialize Network Manager
8383 }
8484
85+ Check if Online
86+ ***************
87+
88+ .. code-block :: arduino
89+
90+ bool isOnline();
91+
92+ Check if the device is online by verifying if any network interface (except AP) has an assigned IPv4 or global IPv6 address.
93+ Returns ``true `` if such interface has been found, ``false `` if no interface has assigned IP.
94+
95+ **Example: **
96+
97+ .. code-block :: arduino
98+
99+ #include "Network.h"
100+
101+ void setup() {
102+ Serial.begin(115200);
103+ Network.begin(); // Initialize Network Manager
104+
105+ // Connect to WiFi AP
106+ WiFi.STA.begin();
107+ WiFi.STA.connect("ssid", "password");
108+
109+ // Wait for WiFi to connect
110+ while (!WiFi.STA.hasIP()) {
111+ delay(500);
112+ }
113+
114+ if (Network.isOnline()) {
115+ Serial.println("Network is Online");
116+ }
117+ }
118+
85119 Default Interface Management
86120****************************
87121
You can’t perform that action at this time.
0 commit comments