From 1ee08d0a1ef6be2dc6793e801c7b73b4c5c57a6f Mon Sep 17 00:00:00 2001 From: Mathieu Carbou Date: Sun, 15 Dec 2024 17:00:32 +0100 Subject: [PATCH 1/2] update example --- examples/Client/Client.ino | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/Client/Client.ino b/examples/Client/Client.ino index 20d1bcf..202edb3 100644 --- a/examples/Client/Client.ino +++ b/examples/Client/Client.ino @@ -2,14 +2,14 @@ #include #include -// #define HOST "homeassistant.local" -// #define PORT 8123 - -// #define HOST "www.google.com" -// #define PORT 80 - +// Run a server at the root of the project with: +// > python3 -m http.server 3333 +// Now you can open a browser and test it works by visiting http://192.168.125.122:3333/ or http://192.168.125.122:3333/README.md #define HOST "192.168.125.122" -#define PORT 4000 +#define PORT 3333 + +// WiFi SSID to connect to +#define WIFI_SSID "IoT" // 16 slots on esp32 (CONFIG_LWIP_MAX_ACTIVE_TCP) #define MAX_CLIENTS CONFIG_LWIP_MAX_ACTIVE_TCP @@ -48,7 +48,7 @@ void makeRequest() { // Serial.printf("** data received by client: %" PRIu16 ": len=%u\n", client->localPort(), len); }); - client->write("GET / HTTP/1.1\r\nHost: " HOST "\r\nUser-Agent: ESP\r\nConnection: close\r\n\r\n"); + client->write("GET /README.md HTTP/1.1\r\nHost: " HOST "\r\nUser-Agent: ESP\r\nConnection: close\r\n\r\n"); }); if (client->connect(HOST, PORT)) { @@ -63,7 +63,7 @@ void setup() { continue; WiFi.mode(WIFI_STA); - WiFi.begin("IoT"); + WiFi.begin(WIFI_SSID); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); From c5af87aa55eefe7e9b461635ec46917b8245d125 Mon Sep 17 00:00:00 2001 From: Mathieu Carbou Date: Sun, 15 Dec 2024 17:07:41 +0100 Subject: [PATCH 2/2] update example --- examples/Client/Client.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/Client/Client.ino b/examples/Client/Client.ino index 202edb3..609af6d 100644 --- a/examples/Client/Client.ino +++ b/examples/Client/Client.ino @@ -45,7 +45,7 @@ void makeRequest() { }); client->onData([](void* arg, AsyncClient* client, void* data, size_t len) { - // Serial.printf("** data received by client: %" PRIu16 ": len=%u\n", client->localPort(), len); + Serial.printf("** data received by client: %" PRIu16 ": len=%u\n", client->localPort(), len); }); client->write("GET /README.md HTTP/1.1\r\nHost: " HOST "\r\nUser-Agent: ESP\r\nConnection: close\r\n\r\n");