mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-10-25 05:25:06 +08:00
1.3 KiB
1.3 KiB
mDNS example
Shows how to use mDNS to advertise lookup services and hosts
Example workflow
- mDNS is initialized with host name and instance name defined through
make menuconfigand_http._tcpservice is added to be advertised - WiFi STA is started and trying to connect to the access point defined through
make menuconfig - The system event handler is used to pass the network events to mDNS so the service is aware when the interface comes up or down
- GPIO0 (BOOT Button) is initialized as pulled-up input that can be monitored for button press
- Example task is started to check if the button is pressed so it can execute the mDNS queries defined
Running the example
- Run
make menuconfigto configure the access point's SSID and Password and the default device mDNS host name and instance name - Run
make flash monitorto build and upload the example to your board and connect to it's serial terminal - Wait for WiFi to connec to your access point
- You can now ping the device at
[hostname].localand browse for_http._tcpon the same network to find the advertised service - Pressing the BOOT button will start quring the local network for the predefined in
check_buttonhosts and services
See the README.md file in the upper level 'examples' directory for more information about examples.