#include // For ESP32, use #include const char* ssid = "ESP_AP"; // AP SSID const char* password = "12345678"; // AP Password const char* host = "192.168.4.1"; // AP IP address (usually this for ESP AP) const int port = 80; // TCP port void setup() { Serial.begin(115200); WiFi.begin(ssid, password); // Connect to the AP while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected."); Serial.println("IP address: "); Serial.println(WiFi.localIP()); // Connect to the server WiFiClient client; if (!client.connect(host, port)) { Serial.println("Connection to host failed"); delay(1000); return; } Serial.println("Connected to server"); // Make a request client.println("Hello from Client"); client.println(); // Wait for the response and print it while(client.available() == 0) { delay(100); } while(client.available()) { char c = client.read(); Serial.write(c); } client.stop(); // Disconnect from the server } void loop() { // Nothing to do here }