We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dbfc60f commit f967c22Copy full SHA for f967c22
1 file changed
app_test.py
@@ -26,16 +26,22 @@ def get_ip():
26
s.close()
27
return IP
28
29
+# --- ZEROCONF SETUP ---
30
+my_ip = get_ip()
31
+zeroconf = Zeroconf(interfaces=[my_ip]) # Explicitly bind to the LAN IP
32
+
33
class MyListener:
34
def remove_service(self, zeroconf, type, name):
35
short_name = name.split('.')[0]
36
if short_name in found_servers:
37
del found_servers[short_name]
38
39
def add_service(self, zeroconf, type, name):
40
+ self.update_service(zeroconf, type, name) # Redirect to update logic
41
42
+ def update_service(self, zeroconf, type, name):
43
info = zeroconf.get_service_info(type, name)
44
if info:
- # Convert binary IP to string
45
addresses = [socket.inet_ntoa(addr) for addr in info.addresses]
46
if addresses:
47
0 commit comments