Chapter 2. API Reference
• service_type: service type (_http, _ftp, etc)
• proto: service protocol (_tcp, _udp)
• hostname: service hostname. If NULL, local hostname will be used.
• port: service port
• txt: string array of TXT data (eg. {{“var”,”val”},{“other”,”2”}})
• num_items: number of items in TXT data
bool mdns_service_exists(const char *service_type, const char *proto, const char *hostname)
Check whether a service has been added.
Return
• true Correspondding service has been added.
• false Service not found.
Parameters
• service_type: service type (_http, _ftp, etc)
• proto: service protocol (_tcp, _udp)
• hostname: service hostname. If NULL, checks for the local hostname.
bool mdns_service_exists_with_instance(const char *instance, const char *service_type,
const char *proto, const char *hostname)
Check whether a service has been added.
Return
• true Correspondding service has been added.
• false Service not found.
Parameters
• instance: instance name
• service_type: service type (_http, _ftp, etc)
• proto: service protocol (_tcp, _udp)
• hostname: service hostname. If NULL, checks for the local hostname.
esp_err_t mdns_service_remove(const char *service_type, const char *proto)
Remove service from mDNS server.
Return
• ESP_OK success
• ESP_ERR_INVALID_ARG Parameter error
• ESP_ERR_NOT_FOUND Service not found
• ESP_ERR_NO_MEM memory error
Parameters
• service_type: service type (_http, _ftp, etc)
• proto: service protocol (_tcp, _udp)
esp_err_t mdns_service_remove_for_host(const char *service_type, const char *proto,
const char *hostname)
Remove service from mDNS server with hostname.
Return
• ESP_OK success
• ESP_ERR_INVALID_ARG Parameter error
• ESP_ERR_NOT_FOUND Service not found
• ESP_ERR_NO_MEM memory error
Parameters
• service_type: service type (_http, _ftp, etc)
• proto: service protocol (_tcp, _udp)
• hostname: service hostname. If NULL, local hostname will be used.
esp_err_t mdns_service_instance_name_set(const char *service_type, const char *proto,
const char *instance_name)
Set instance name for service.
Return
• ESP_OK success
• ESP_ERR_INVALID_ARG Parameter error
Espressif Systems 613
Submit Document Feedback
Release v4.4