Chapter 2. API Reference
esp_err_t mdns_service_txt_item_remove_for_host(const char *service_type, const char
*proto, const char *hostname, const
char *key)
Remove TXT item for service TXT record 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.
• key: the key that you want to remove
esp_err_t mdns_service_remove_all(void)
Remove and free all services from mDNS server.
Return
• ESP_OK success
• ESP_ERR_INVALID_ARG Parameter error
esp_err_t mdns_query_async_delete(mdns_search_once_t *search)
Deletes the finished query. Call this only after the search has ended!
Return
• ESP_OK success
• ESP_ERR_INVALID_STATE search has not finished
• ESP_ERR_INVALID_ARG pointer to search object is NULL
Parameters
• search: pointer to search object
bool mdns_query_async_get_results(mdns_search_once_t *search, uint32_t timeout,
mdns_result_t **results)
Get results from search pointer. Results available as a pointer to the output parameter. Pointer to search object
has to be deleted via mdns_query_async_delete once the query has finished. The results although have
to be freed manually.
Return True if search has finished before or at timeout False if search timeout is over
Parameters
• search: pointer to search object
• timeout: time in milliseconds to wait for answers
• results: pointer to the results of the query
mdns_search_once_t *mdns_query_async_new(const char *name, const char *service_type,
const char *proto, uint16_t type, uint32_t timeout,
size_t max_results, mdns_query_notify_t notifier)
Query mDNS for host or service asynchronousely. Search has to be tested for progress and deleted manually!
Return mdns_search_once_s pointer to new search object if query initiated successfully. NULL otherwise.
Parameters
• name: service instance or host name (NULL for PTR queries)
• service_type: service type (_http, _arduino, _ftp etc.) (NULL for host queries)
• proto: service protocol (_tcp, _udp, etc.) (NULL for host queries)
• type: type of query (MDNS_TYPE_*)
• timeout: time in milliseconds during which mDNS query is active
• max_results: maximum results to be collected
• notifier: Notification function to be called when the result is ready, can be NULL
esp_err_t mdns_query(const char *name, const char *service_type, const char *proto, uint16_t type,
uint32_t timeout, size_t max_results, mdns_result_t **results)
Query mDNS for host or service All following query methods are derived from this one.
Espressif Systems 617
Submit Document Feedback
Release v4.4