-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c3a39f8
Showing
7 changed files
with
1,943 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from Zeroconf import * | ||
import socket | ||
|
||
class MyListener(object): | ||
def __init__(self): | ||
self.r = Zeroconf() | ||
pass | ||
|
||
def removeService(self, zeroconf, type, name): | ||
print "Service", name, "removed" | ||
|
||
def addService(self, zeroconf, type, name): | ||
print "Service", name, "added" | ||
print "Type is", type | ||
info = self.r.getServiceInfo(type, name) | ||
print "Address is", str(socket.inet_ntoa(info.getAddress())) | ||
print "Port is", info.getPort() | ||
print "Weight is", info.getWeight() | ||
print "Priority is", info.getPriority() | ||
print "Server is", info.getServer() | ||
print "Text is", info.getText() | ||
print "Properties are", info.getProperties() | ||
|
||
if __name__ == '__main__': | ||
print "Multicast DNS Service Discovery for Python Browser test" | ||
r = Zeroconf() | ||
print "1. Testing browsing for a service..." | ||
type = "_http._tcp.local." | ||
listener = MyListener() | ||
browser = ServiceBrowser(r, type, listener) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
This is Multicast DNS Service Discovery for Python v0.12 by Paul Scott-Murphy. | ||
|
||
Zeroconf.py is the implementation file, look at the end for examples of | ||
basic use. You can also view Browser.py to see how to browse for services. |
Oops, something went wrong.