Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
paulsm committed May 11, 2009
0 parents commit c3a39f8
Show file tree
Hide file tree
Showing 7 changed files with 1,943 additions and 0 deletions.
30 changes: 30 additions & 0 deletions Browser.py
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)
4 changes: 4 additions & 0 deletions README
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.
Loading

0 comments on commit c3a39f8

Please sign in to comment.