How to use the discover.MyUDPHandler function in discover

To help you get started, we’ve selected a few discover examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github adulau / Forban / bin / forban_discover.py View on Github external
print "In any case, Forban should be able to work even without the config file"
    forbanpath = os.path.join(guesspath())
except ConfigParser.NoOptionError:
    forbanpath = os.path.join(guesspath())

forbanpathlib = os.path.join(forbanpath,"lib")
sys.path.append(forbanpathlib)

import discover


if __name__ == "__main__":

    while 1:
        HOST, PORT = ("", 12555)
        server = discover.UDPServer((HOST, PORT), discover.MyUDPHandler)
	if disable_ipv6 == "1":
              server.setIPv6 ( 0 )
	else:
              server.setIPv6 ( 1 )
        server.serve_forever()