We Recommend

Learning Python Learning Python
The authors of Learning Python show you enough essentials of the Python scripting language to enable you to begin solving problems right away, then reveal more powerful aspects of the language one at a time. This approach is sure to appeal to programmers and system administrators who have urgent problems and a preference for learning by semi-guided experimentation.


Posted By

yarvin on 01/23/08


Tagged

python configuration zero networking Zeroconf


Versions (?)


Zeroconf and Python


Published in: Python 


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

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

  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)

Report this snippet 

You need to login to post a comment.