mirror of
				https://github.com/esp8266/Arduino.git
				synced 2025-11-03 14:33:37 +03:00 
			
		
		
		
	Allow mDNS on any interface
This commit is contained in:
		@@ -74,7 +74,7 @@ uint8_t WiFiUDP::begin(uint16_t port)
 | 
				
			|||||||
    return (_ctx->listen(addr, port)) ? 1 : 0;
 | 
					    return (_ctx->listen(addr, port)) ? 1 : 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uint8_t WiFiUDP::beginMulticast(IPAddress multicast, uint16_t port)
 | 
					uint8_t WiFiUDP::beginMulticast(IPAddress interfaceAddr, IPAddress multicast, uint16_t port)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (_ctx)
 | 
					    if (_ctx)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@@ -84,7 +84,7 @@ uint8_t WiFiUDP::beginMulticast(IPAddress multicast, uint16_t port)
 | 
				
			|||||||
    
 | 
					    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ip_addr_t ifaddr;
 | 
					    ip_addr_t ifaddr;
 | 
				
			||||||
    ifaddr.addr = (uint32_t) WiFi.localIP();
 | 
					    ifaddr.addr = (uint32_t) interfaceAddr;
 | 
				
			||||||
    ip_addr_t multicast_addr;
 | 
					    ip_addr_t multicast_addr;
 | 
				
			||||||
    multicast_addr.addr = (uint32_t) multicast;
 | 
					    multicast_addr.addr = (uint32_t) multicast;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,7 +42,7 @@ public:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  virtual uint8_t begin(uint16_t port);	// initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use
 | 
					  virtual uint8_t begin(uint16_t port);	// initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use
 | 
				
			||||||
  virtual void stop();  // Finish with the UDP socket
 | 
					  virtual void stop();  // Finish with the UDP socket
 | 
				
			||||||
  uint8_t beginMulticast(IPAddress multicast, uint16_t port); // connect to a multicast group and listen on the given port
 | 
					  uint8_t beginMulticast(IPAddress interfaceAddr, IPAddress multicast, uint16_t port); // connect to a multicast group and listen on the given port
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Sending UDP packets
 | 
					  // Sending UDP packets
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -149,7 +149,7 @@ bool MDNSResponder::begin(const char* domain, IPAddress addr, uint32_t ttlSecond
 | 
				
			|||||||
  
 | 
					  
 | 
				
			||||||
  // Open the MDNS socket if it isn't already open.
 | 
					  // Open the MDNS socket if it isn't already open.
 | 
				
			||||||
  if (!_mdnsConn) {
 | 
					  if (!_mdnsConn) {
 | 
				
			||||||
    if (!_mdnsConn.beginMulticast(IPAddress(224, 0, 0, 251), 5353)) {
 | 
					    if (!_mdnsConn.beginMulticast(addr, IPAddress(224, 0, 0, 251), 5353)) {
 | 
				
			||||||
      return false;
 | 
					      return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user