blob: 18e440f320f83c0a0492e07e25cb3c92a3da0697 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#!/usr/bin/env python
""" Example of announcing a service (in this case, a fake HTTP server) """
import socket
from zeroconf import raw_input, ServiceInfo, Zeroconf
desc = {'path': '/~paulsm/'}
info = ServiceInfo("_http._tcp.local.",
"Paul's Test Web Site._http._tcp.local.",
socket.inet_aton("10.0.1.2"), 80, 0, 0,
desc, "ash-2.local.")
zeroconf = Zeroconf()
print("Registration of a service...")
zeroconf.register_service(info)
try:
raw_input("Waiting (press Enter to exit)...")
finally:
print("Unregistering...")
zeroconf.unregister_service(info)
zeroconf.close()
|