Skip to content

setting hostname issue #174

@societyofrobots

Description

@societyofrobots

Had trouble setting the hostname; it was only displaying 'espressif'. This caused an issue when having more than one ESP32 connected on the same router.

Others also had the problem, but you weren't able to solve it at the time.

I managed to solve it with a dirty hack (I'm a weak programmer, forgive me!).

In setup(), right after
server.onNotFound({ iotWebConf.handleNotFound(); });
I added this code:

WiFi.disconnect(true);
WiFi.config(INADDR_NONE, INADDR_NONE, INADDR_NONE); // call is only a workaround for bug in WiFi class
WiFi.setHostname(thingName.c_str());

This is the info that helped me do this:

https://stackoverflow.com/questions/57570586/how-to-correctly-set-the-hostname-for-the-tcp-ip-adapter-on-the-esp32
espressif/arduino-esp32#806 (comment)
espressif/arduino-esp32#2537 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions