mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
Multicast in SoftAP mode (#96)
SDK 1.3 fixed a bug which caused multicast UDP to fail on SoftAP interface. Update MDNSResponder and documentation appropriately.
This commit is contained in:
parent
208ae95979
commit
6cf18ed1a2
@ -290,7 +290,6 @@ When listening to multicast packets, replace `udp.begin(port)` with
|
||||
`udp.beginMulticast(WiFi.localIP(), multicast_ip_addr, port)`.
|
||||
You can use `udp.destinationIP()` to tell whether the packet received was
|
||||
sent to the multicast or unicast address.
|
||||
Also note that multicast doesn't work on softAP interface.
|
||||
|
||||
`WiFiServer`, `WiFiClient`, and `WiFiUDP` behave mostly the same way as with WiFi shield library.
|
||||
Four samples are provided for this library.
|
||||
@ -373,7 +372,6 @@ instead of the one that comes with this package.
|
||||
## mDNS and DNS-SD responder (ESP8266mDNS library)
|
||||
|
||||
Allows the sketch to respond to multicast DNS queries for domain names like "foo.local", and DNS-SD (service dicovery) queries.
|
||||
Currently the library only works on STA interface, AP interface is not supported.
|
||||
See attached example for details.
|
||||
|
||||
## SSDP responder (ESP8266SSDP)
|
||||
|
@ -163,15 +163,21 @@ uint16_t MDNSResponder::_getServicePort(char *name, char *proto){
|
||||
}
|
||||
|
||||
uint32_t MDNSResponder::_getOurIp(){
|
||||
if(wifi_get_opmode() & STATION_MODE){
|
||||
int mode = wifi_get_opmode();
|
||||
if(mode & STATION_MODE){
|
||||
struct ip_info staIpInfo;
|
||||
wifi_get_ip_info(STATION_IF, &staIpInfo);
|
||||
return staIpInfo.ip.addr;
|
||||
}
|
||||
} else if (mode & SOFTAP_MODE) {
|
||||
struct ip_info staIpInfo;
|
||||
wifi_get_ip_info(SOFTAP_IF, &staIpInfo);
|
||||
return staIpInfo.ip.addr;
|
||||
} else {
|
||||
#ifdef MDNS_DEBUG_ERR
|
||||
os_printf("ERR_NO_LOCAL_IP\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void MDNSResponder::_parsePacket(){
|
||||
|
@ -13,7 +13,6 @@ Requirements:
|
||||
|
||||
Usage:
|
||||
- Include the ESP8266 Multicast DNS library in the sketch.
|
||||
- Create an instance of the MDNSResponder class.
|
||||
- Call the begin method in the sketch's setup and provide a domain name (without
|
||||
the '.local' suffix, i.e. just provide 'foo' to resolve 'foo.local'), and the
|
||||
Adafruit CC3000 class instance. Optionally provide a time to live (in seconds)
|
||||
|
Loading…
x
Reference in New Issue
Block a user