From c0f69cd278f5a489f439655135d1b1678b23d51e Mon Sep 17 00:00:00 2001 From: pmantoine Date: Thu, 1 Feb 2024 20:22:32 +0900 Subject: [PATCH] mDNS entry now uses IP_PORT and WIFI_HOSTNAME --- EthernetInterface.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/EthernetInterface.cpp b/EthernetInterface.cpp index 8c605e2..450253d 100644 --- a/EthernetInterface.cpp +++ b/EthernetInterface.cpp @@ -187,8 +187,8 @@ bool EthernetInterface::checkLink() { } LCD(4,F("IP: %d.%d.%d.%d"), ip[0], ip[1], ip[2], ip[3]); LCD(5,F("Port:%d"), IP_PORT); - mdns.begin(Ethernet.localIP(), "dccex"); // hostname - mdns.addServiceRecord("dccex._withrottle", 2560, MDNSServiceTCP); + mdns.begin(Ethernet.localIP(), WIFI_HOSTNAME); // hostname + mdns.addServiceRecord(WIFI_HOSTNAME "._withrottle", IP_PORT, MDNSServiceTCP); // only create a outboundRing it none exists, this may happen if the cable // gets disconnected and connected again if(!outboundRing) @@ -196,7 +196,7 @@ bool EthernetInterface::checkLink() { } return true; } else { // LinkOFF - if (connected) { + if (connected) { // Were connected, but no longer without a LINK! DIAG(F("Ethernet cable disconnected")); connected=false; //clean up any client @@ -204,6 +204,7 @@ bool EthernetInterface::checkLink() { if(clients[socket].connected()) clients[socket].stop(); } + mdns.removeServiceRecord(IP_PORT, MDNSServiceTCP); // tear down server delete server; server = nullptr;