Zeroconf and Python


/ Published in: Python
Save to your folder(s)

taken from http://www.amk.ca/python/zeroconf


Copy this code and paste it in your HTML
  1. import Zeroconf
  2. import socket
  3.  
  4. server = Zeroconf.Zeroconf()
  5.  
  6. # Get local IP address
  7. local_ip = socket.gethostbyname(socket.gethostname())
  8. local_ip = socket.inet_aton(local_ip)
  9.  
  10. svc1 = Zeroconf.ServiceInfo('_durus._tcp.local.',
  11. 'Database 1._durus._tcp.local.',
  12. address = local_ip,
  13. port = 2972,
  14. weight = 0, priority=0,
  15. properties = {'description':
  16. 'Departmental server'}
  17. )
  18. server.registerService(svc1)

URL: http://www.amk.ca/python/zeroconf

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.