Advertisement
Guest User

Untitled

a guest
May 4th, 2020
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. from zeroconf import ServiceBrowser, Zeroconf
  2.  
  3. class MyListener:
  4.     def remove_service(self, zeroconf, type, name):
  5.         print("Service %s removed" % (name,))
  6.     def add_service(self, zeroconf, type, name):
  7.         info = zeroconf.get_service_info(type, name)
  8.         print("Service %s added, service info: %s" % (name, info))
  9.  
  10. zeroconf = Zeroconf()
  11. listener = MyListener()
  12. browser = ServiceBrowser(zeroconf, "_airplay._tcp.local.", listener)
  13. try:
  14.     input("Press enter to exit...\n\n")
  15. finally:
  16.     zeroconf.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement