Skip to content

Commit eecdd77

Browse files
committed
Major WiFi overhaul
- auto reconnect on connection loss now works - moved to event groups - some code clean up and procedure optimizations - new methods to get a more elaborate system ststus
1 parent 3672415 commit eecdd77

File tree

8 files changed

+368
-195
lines changed

8 files changed

+368
-195
lines changed

libraries/WiFi/src/WiFiClient.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919

2020
#include "WiFiClient.h"
21+
#include "WiFi.h"
2122
#include <lwip/sockets.h>
2223
#include <lwip/netdb.h>
2324
#include <errno.h>
@@ -105,12 +106,10 @@ int WiFiClient::connect(IPAddress ip, uint16_t port)
105106

106107
int WiFiClient::connect(const char *host, uint16_t port)
107108
{
108-
struct hostent *server;
109-
server = gethostbyname(host);
110-
if (server == NULL) {
109+
IPAddress srv((uint32_t)0);
110+
if(!WiFiGenericClass::hostByName(host, srv)){
111111
return 0;
112112
}
113-
IPAddress srv((const uint8_t *)(server->h_addr));
114113
return connect(srv, port);
115114
}
116115

0 commit comments

Comments
 (0)