blob: 293047f4948fcc015aec1e8a25608217240f8e69 (
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.registerService(info)
try:
raw_input("Waiting (press Enter to exit)...")
finally:
print("Unregistering...")
zeroconf.unregisterService(info)
zeroconf.close()
|