ESP8266mDNS using the provided IP in the begin method #2349
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
this fix forces the mDNS to use the provided IP in the begin method
instead of the auto detected IP. this is required if the ESP8266 starts
in the AP_STA mode and activates only the AP initially.
because of the old behaviour of the begin method, and how the ip is retrieved, if the current mode is AP_STA, only the STA ip will be tried. the fix allows the usage of the explicitly provided IP. now I can start the esp in AP_STA, with only AP active, and provide the AP ip. when STA will be connected the mDNS will continue to listen for connections on the AP IP, not disrupting the behaviour.
there still might be a problem in how the mDNS behaves when using the begin method with only the hostname and the initial mode is AP, then esp moves to AP_STA and connects to a station, as it subscribes to station events even when started in AP.