mdns_service_add_for_host() function
Add service to mDNS server with a delegated hostname
Arguments
instance_name
instance name to set. If NULL, global instance name or hostname will be used Note that MDNS_MULTIPLE_INSTANCE config option needs to be enabled for adding multiple instances with the same instance type.
service_type
service type (_http, _ftp, etc)
proto
service protocol (_tcp, _udp)
hostname
service hostname. If NULL, local hostname will be used.
txt
string array of TXT data (eg. {{"var","val"},{"other","2"}})
num_items
number of items in TXT data
Return value
- ESP_OK success - ESP_ERR_INVALID_ARG Parameter error - ESP_ERR_NO_MEM memory error - ESP_FAIL failed to add service
Notes
The value length of txt items will be automatically decided by strlen
![]()
esp_err_t mdns_service_add_for_host(const char *instance, const char *service, const char *proto, const char *host,
mdns_service_add_for_host() is called by 2 functions and calls 12 functions:
![]()
mdns_service_add_for_host()
mdns_service_add_for_host() reads 10 variables and writes 3 variables:
![]()
mdns_service_add_for_host()