Data Sheet
!
4. Wi-Fi AT Commands
4.2.37. AT+MDNS—Configures the MDNS Function
4.2.38. AT+CWHOSTNAME—Configures the Name of ESP8266 Station
Set Command
AT+MDNS=<enable>,<hostname>,<server_name>,<server_port>
Response
OK
or
ERROR
Parameters
• <enable>:
‣ 1: enables the MDNS function; the following three parameters need to be set.
‣ 0: disables the MDNS function; the following three parameters need not to be set.
• <hostname>: MDNS host name
• <server_name>: MDNS server name
• <server_port>: MDNS server port
Notes
• Please do not use special characters (such as.) or a protocol name (for example, http)
for <hostname> and <server_name>.
• ESP8266 SoftAP mode does not support the MDNS function for now.
Example
AT+MDNS=1,"espressif","iot",8080
Commands
Query Command:
AT+CWHOSTNAME?
Function: Checks the host name of ESP8266 Station.
Set Command:
AT+CWHOSTNAME=<hostname>
Function: Sets the host name of ESP8266
Station.
Response
+CWHOSTNAME:<hostname>
OK
If the station mode is not enabled, the command will
return:
+CWHOSTNAME:<null>
OK
OK
If the Station mode is not enabled, the
command will return:
ERROR
Parameters
<hostname>: the host name of the ESP8266 Station.
Notes
• The configuration changes are not saved in the flash.
• The default host name of the ESP8266 Station is ESP_XXXXXX; XXXXXX is the lower 3 bytes of the
MAC address, for example, +CWHOSTNAME:<ESP_A378DA>.
Example
AT+CWMODE=3
AT+CWHOSTNAME="my_test"
Espressif
! /5240
2017.05