From 19f486940121871297ca618fd88192aa284c5e45 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Sat, 9 Nov 2024 12:57:49 +0100 Subject: [PATCH] multicast receive tests --- EthernetInterface.cpp | 13 ++++++++++++- STM32lwipopts.h | 6 +++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/EthernetInterface.cpp b/EthernetInterface.cpp index 1e49a21..2acb92f 100644 --- a/EthernetInterface.cpp +++ b/EthernetInterface.cpp @@ -36,9 +36,17 @@ #define DO_MDNS EthernetUDP udp; MDNS mdns(udp); +void serviceFound(const char* type, MDNSServiceProtocol /*proto*/, const char* name, IPAddress ip, + unsigned short port, const char* txtContent) +{ + if (name == NULL) { + DIAG("End service discovery of %s", type); + return; + } + DIAG("Got %s of type %s", name, type); +} #endif - //extern void looptimer(unsigned long timeout, const FSH* message); #define looptimer(a,b) @@ -117,7 +125,10 @@ void EthernetInterface::setup() outboundRing=new RingStream(OUTBOUND_RING_SIZE); #ifdef DO_MDNS mdns.begin(Ethernet.localIP(), WIFI_HOSTNAME); // hostname + udp.begin(IPAddress(224, 0, 0, 251), 5353, true); mdns.addServiceRecord(WIFI_HOSTNAME "._withrottle", IP_PORT, MDNSServiceTCP); +// mdns.setServiceFoundCallback(serviceFound); +// mdns.startDiscoveringService("_withrottle", MDNSServiceTCP, 0); // Not sure if we need to run it once, but just in case! mdns.run(); #endif diff --git a/STM32lwipopts.h b/STM32lwipopts.h index 68cb992..d4053e8 100644 --- a/STM32lwipopts.h +++ b/STM32lwipopts.h @@ -252,8 +252,12 @@ The STM32F4x7 allows computing and verifying the IP, UDP, TCP and ICMP checksums * an operating system. */ //#define ETH_INPUT_USE_IT 1 -#define LWIP_MDNS_RESPONDER 1 +// We don't need this as we do not need to respond - we only announce +//#define LWIP_MDNS_RESPONDER 1 +//#define LWIP_NUM_NETIF_CLIENT_DATA 1 // MDNS needs at least one #define LWIP_IGMP 1 +#define SO_REUSE 1 +#define SO_REUSE_RXTOALL 1 #warning testing this #endif /* __STM32LWIPOPTS_H__ */