Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

esp32 dhcp server

WiFiServer server(80);

static const char *ap_ssid = "ESP32-001";
static const char *ap_pass = "temp_pass";

void setup() {
  Serial.begin(115200);

  WiFi.softAP(ap_ssid, ap_pass);
  Serial.print("Access point running. IP address: ");
  Serial.print(WiFi.softAPIP());
  Serial.println("");

  server.begin();
}

void loop() {
  WiFiClient client = server.available();

  if (client) {
    String client_ip = client.remoteIP().toString();
    Serial.print("Client connected. IP address = ");
    Serial.print(client_ip);
    Serial.println("");
    client.println("Hello ...");
    client.stop();
  }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #dhcp #server
ADD COMMENT
Topic
Name
6+2 =