def main(): # build a parser for the command line arguments parser = ArgumentParser(description=__doc__) # sample additional argument to change the prompt parser.add_argument( "--prompt", type=str, default="> ", help="change the prompt", ) # parse the command line arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make a console this_console = ConsoleCmdTemplate(prompt=args.prompt) if _debug: _log.debug(" - this_console: %r", this_console) # enable sleeping will help with threads enable_sleeping() _log.debug("running") run() _log.debug("fini")
def main(): # parse the command line arguments parser = ArgumentParser(description=__doc__) # add an argument for seconds per dog parser.add_argument( 'seconds', metavar='N', type=int, nargs='+', help='number of seconds for each dog', ) # now parse the arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make some dogs for i, sec in enumerate(args.seconds): dog = PrairieDog(i, sec * 1000) if _debug: _log.debug(" - dog: %r", dog) _log.debug("running") run() _log.debug("fini")
def main(): # parse the command line arguments parser = ArgumentParser(description=__doc__) # add an argument for seconds per dog parser.add_argument('seconds', metavar='N', type=int, nargs='+', help='number of seconds for each dog', ) # now parse the arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make some dogs for i, sec in enumerate(args.seconds): dog = PrairieDog(i, sec * 1000) if _debug: _log.debug(" - dog: %r", dog) _log.debug("running") run() _log.debug("fini")
def main(): # parse the command line arguments parser = ArgumentParser(usage=__doc__) args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make a network network = IPNetwork() console = ConsoleClient() middle_man = MiddleMan() bip = BIPSimple() annexj = AnnexJCodec() mux = FauxMultiplexer("192.168.0.1/24", network) bind(console, middle_man, bip, annexj, mux) # add some more debugging nodes for i in range(2, 4): debug_address = "192.168.0.{}/24".format(i) debug_debug = Debug(debug_address) debug_bip = BIPSimple() debug_annexj = AnnexJCodec() debug_mux = FauxMultiplexer(debug_address, network) bind(debug_debug, debug_bip, debug_annexj, debug_mux) _log.debug("running") run() _log.debug("fini")
def main(): # parse the command line arguments parser = ArgumentParser(usage=__doc__) args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) address = Address("192.168.0.1/24") if _debug: _log.debug(" - local_address: %r", address) # make a network network = IPNetwork() console = ConsoleClient() middle_man = MiddleMan() fauxmux = FauxMux(address, network) bind(console, middle_man, fauxmux) # add some more debugging nodes for i in range(2, 4): debug_address = "192.168.0.{}/24".format(i) debug_debug = Debug(debug_address) debug_fauxmux = FauxMux(Address(debug_address), network) bind(debug_debug, debug_fauxmux) _log.debug("running") run() _log.debug("fini")
def main(): global this_console # build a parser for the command line arguments parser = ArgumentParser(description=__doc__) # sample additional argument to change the prompt parser.add_argument( "--prompt", type=str, default="> ", help="change the prompt", ) # parse the command line arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make a console this_console = ConsoleCmdTemplate(prompt=args.prompt) _log.debug("running") run()
def main(): # parse the command line arguments parser = ArgumentParser(description=__doc__) # now parse the arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make a controller this_controller = SieveClientController() if _debug: _log.debug(" - this_controller: %r", this_controller) # local IO functions bind(this_controller, ModbusClient()) # if this is being run, then a console is handy this_console = ConsoleClient(this_controller) if _debug: _log.debug(" - this_console: %r", this_console) _log.debug("running") run() _log.debug("fini")
def main(): # parse the command line arguments parser = ArgumentParser(description=__doc__) # now parse the arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) _log.debug("running") run() _log.debug("fini")
def main(): # parse the command line arguments parser = ArgumentParser(description=__doc__) args = parser.parse_args() if _debug: _log.debug(" - args: %r", args) for packet_data in parse_stream(sample): data = xtob(packet_data) packet = decode_packet(data) if not packet: continue x = {"apdu": packet.dict_contents()} json.dump(x, sys.stdout, indent=4)
def main(): # parse the command line arguments args = ArgumentParser(description=__doc__).parse_args() global this_switch, this_console if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make some debugging terminals debug1 = DebugTerm("a") debug2 = DebugTerm("b") # make a switch with them this_switch = Switch(a=debug1, b=debug2) if _debug: _log.debug(" this_switch: %r", this_switch) # make a test console this_console = TestConsoleCmd() if _debug: _log.debug(" this_console: %r", this_console) # bind the console to the top and bottom of the switch bind(this_console, this_switch, this_console) # enable sleeping will help with threads enable_sleeping() _log.debug("running") run() _log.debug("fini")
def main(): global args # parse the command line arguments args = ArgumentParser(description=__doc__).parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make a controller for to_do_item requests controller = SomethingController() if _debug: _log.debug(" - controller: %r", controller) for i in range(3): # make a list bound to the contoller to_do_list = ToDoList(controller, active_limit=2) if _debug: _log.debug(" - to_do_list: %r", to_do_list) for j in range(5): to_do_list.append(SomethingToDo(i, j)) _log.debug("running") run() _log.debug("fini")
def main() -> None: mqtt_port = os.environ.get("MQTT_PORT", 1883) mqtt_addr = os.environ.get("MQTT_ADDR", "127.0.0.1") ArgumentParser().parse_args() _log.info("Starting bacprop") BacPropagator().start()
def setUpPackage(): global test_options # create an argument parser parser = ArgumentParser(description=__doc__) # add an option parser.add_argument('--option', help="this is an option", default=os.getenv("BACPYPES_TEST_OPTION") or BACPYPES_TEST_OPTION, ) # get the debugging args and parse them arg_str = os.getenv("BACPYPES_TEST") or BACPYPES_TEST test_options = parser.parse_args(arg_str.split()) if _debug: setUpPackage._debug("setUpPackage") if _debug: setUpPackage._debug(" - test_options: %r", test_options)
def main(): """ Main function, called when run as an application. """ global server_address # check the version if (sys.version_info[:2] != (2, 5)): sys.stderr.write("Python 2.5 only\n") sys.exit(1) # parse the command line arguments parser = ArgumentParser(description=__doc__) parser.add_argument( "host", nargs='?', help="address of host (default %r)" % (SERVER_HOST, ), default=SERVER_HOST, ) parser.add_argument( "port", nargs='?', type=int, help="server port (default %r)" % (SERVER_PORT, ), default=SERVER_PORT, ) args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # extract the server address and port host = args.host port = args.port server_address = (host, port) if _debug: _log.debug(" - server_address: %r", server_address) # build the stack this_console = ConsoleClient() if _debug: _log.debug(" - this_console: %r", this_console) this_middle_man = MiddleMan() if _debug: _log.debug(" - this_middle_man: %r", this_middle_man) this_director = TCPClientDirector() if _debug: _log.debug(" - this_director: %r", this_director) bind(this_console, this_middle_man, this_director) bind(MiddleManASE(), this_director) # create a task manager for scheduled functions task_manager = TaskManager() if _debug: _log.debug(" - task_manager: %r", task_manager) # don't wait to connect this_director.connect(server_address) if _debug: _log.debug("running") run()
def main(): # parse the command line arguments parser = ArgumentParser(description=__doc__) parser.add_argument( "--host", type=str, help="address of host (default {!r})".format(SERVER_HOST), default=SERVER_HOST, ) parser.add_argument( "--port", type=int, help="server port (default {!r})".format(SERVER_PORT), default=SERVER_PORT, ) args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # local IO functions bind(SimpleServer(), ModbusServer(port=args.port)) _log.debug("running") run() _log.debug("fini")
def main(): global args # build a parser for the command line arguments parser = ArgumentParser(description=__doc__) # sample additional argument to change the prompt parser.add_argument( "--prompt", type=str, default="> ", help="change the prompt", ) # accept everything else parser.add_argument('args', nargs=argparse.REMAINDER) # parse the command line arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make a console this_console = Shell() if _debug: _log.debug(" - this_console: %r", this_console) # enable sleeping will help with threads enable_sleeping() _log.debug("running") run() _log.debug("fini")
def main(): # parse the command line arguments parser = ArgumentParser(description=__doc__) # now parse the arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make the thread object and start it bacpypes_thread = BACpypesThread() bacpypes_thread.start() # main thread while True: write_flush("#") time.sleep(2)
def setUp(argv=None): global test_options # create an argument parser parser = ArgumentParser(description=__doc__) # add an option parser.add_argument( '--option', help="this is an option", default=os.getenv("BACPYPES_TEST_OPTION") or BACPYPES_TEST_OPTION, ) # get the debugging args and parse them arg_str = os.getenv("BACPYPES_TEST") or BACPYPES_TEST test_options = parser.parse_args(argv or arg_str.split()) if _debug: setUp._debug("setUp") if _debug: setUp._debug(" - test_options: %r", test_options)
def main(): # parse the command line arguments parser = ArgumentParser(description=__doc__) # now parse the arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make the thread object and start it process_thread = ProcessThread() process_thread.start() _log.debug("running") run() _log.debug("fini")
def main(): # parse the command line arguments args = ArgumentParser(description=__doc__).parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # create a controller some_controller = SomeController() if _debug: _log.debug(" - some_controller: %r", some_controller) # test set tests = [ (( 1, 2, ), { 'a': 3 }), (( 4, 5, ), {}), ((6, ), { 'a': 7 }), ] for test_args, test_kwargs in tests: print("test_args, test_kwargs: %r, %r" % (test_args, test_kwargs)) # create a request with some args and kwargs iocb = IOCB(*test_args, **test_kwargs) # add a callback function , called when the request has been processed iocb.add_callback(call_me) # give the request to the controller some_controller.request_io(iocb) # wait for the request to be processed iocb.ioComplete.wait() if _debug: _log.debug(" - iocb: %r", iocb) # dump the contents print("iocb completion event set: %r" % (iocb.ioComplete.is_set(), )) print("") print("iocb successful: %r" % (iocb.ioState == COMPLETED, )) print("iocb response: %r" % (iocb.ioResponse, )) print("") print("iocb aborted: %r" % (iocb.ioState == ABORTED, )) print("iocb error: %r" % (iocb.ioError, )) print("")
def main(): # parse the command line arguments parser = ArgumentParser(description=__doc__) # add an argument for interval parser.add_argument( 'localaddr', type=str, help='local address of the BBMD', ) # add an argument for interval parser.add_argument( 'bdtentry', type=str, nargs='*', help='list of addresses of peers', ) # now parse the arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) local_address = Address(args.localaddr) if _debug: _log.debug(" - local_address: %r", local_address) # create a null client that will accept, but do nothing with upstream # packets from the BBMD null_client = NullClient() if _debug: _log.debug(" - null_client: %r", null_client) # create a BBMD, bound to the Annex J server on a UDP multiplexer bbmd = BIPBBMD(local_address) annexj = AnnexJCodec() multiplexer = UDPMultiplexer(local_address) # bind the layers together bind(null_client, bbmd, annexj, multiplexer.annexJ) # loop through the rest of the addresses for bdtentry in args.bdtentry: if _debug: _log.debug(" - bdtentry: %r", bdtentry) bdt_address = Address(bdtentry) bbmd.add_peer(bdt_address) if _debug: _log.debug(" - bbmd: %r", bbmd) _log.debug("running") run() _log.debug("fini")
def main(): """ Main function, called when run as an application. """ global server_address # parse the command line arguments parser = ArgumentParser(description=__doc__) parser.add_argument( "host", nargs='?', help="address of host", default=default_server_host, ) parser.add_argument( "port", nargs='?', type=int, help="server port", default=default_server_port, ) args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # extract the server address and port host = args.host port = args.port server_address = (host, port) if _debug: _log.debug(" - server_address: %r", server_address) # build the stack this_console = ConsoleClient() if _debug: _log.debug(" - this_console: %r", this_console) this_middle_man = MiddleMan() if _debug: _log.debug(" - this_middle_man: %r", this_middle_man) this_director = TCPClientDirector() if _debug: _log.debug(" - this_director: %r", this_director) bind(this_console, this_middle_man, this_director) bind(MiddleManASE(), this_director) # create a task manager for scheduled functions task_manager = TaskManager() if _debug: _log.debug(" - task_manager: %r", task_manager) # don't wait to connect this_director.connect(server_address) if _debug: _log.debug("running") run()
def main(): # parse the command line arguments parser = ArgumentParser(description=__doc__) # add an argument for interval parser.add_argument('addr1', type=str, help='address of first network', ) # add an argument for interval parser.add_argument('net1', type=int, help='network number of first network', ) # add an argument for interval parser.add_argument('addr2', type=str, help='address of second network', ) # add an argument for interval parser.add_argument('net2', type=int, help='network number of second network', ) # now parse the arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # create the router router = IP2IPRouter(Address(args.addr1), args.net1, Address(args.addr2), args.net2) if _debug: _log.debug(" - router: %r", router) _log.debug("running") run() _log.debug("fini")
def setup_package(): global test_options # create an argument parser parser = ArgumentParser(description=__doc__) # add an option parser.add_argument( '--option', help="this is an option", default=os.getenv("BACPYPES_TEST_OPTION") or BACPYPES_TEST_OPTION, ) # get the debugging args and parse them arg_str = os.getenv("BACPYPES_TEST") or BACPYPES_TEST test_options = parser.parse_args(arg_str.split()) if _debug: setup_package._debug("setup_package") if _debug: setup_package._debug(" - test_options: %r", test_options) time_machine = TimeMachine() if _debug: setup_package._debug(" - time_machine: %r", time_machine)
def main(): try: # parse the command line arguments parser = ArgumentParser(description=__doc__) # now parse the arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # local IO functions bind(ConsoleClient(), ModbusClient()) _log.debug("running") run() except Exception as err: _log.exception("an error has occurred: %s" % (err,)) finally: _log.debug("finally")
def main(): global this_console # build a parser for the command line arguments parser = ArgumentParser(description=__doc__) # sample additional argument to change the prompt parser.add_argument("--prompt", type=str, default="> ", help="change the prompt") # parse the command line arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make a console this_console = ConsoleCmdTemplate(prompt=args.prompt) _log.debug("running") run()
def main(): """ Main function, called when run as an application. """ global server_address # check the version if (sys.version_info[:2] != (2, 5)): sys.stderr.write("Python 2.5 only\n") sys.exit(1) # parse the command line arguments parser = ArgumentParser(description=__doc__) parser.add_argument( "host", nargs='?', help="address of host (default %r)" % (SERVER_HOST,), default=SERVER_HOST, ) parser.add_argument( "port", nargs='?', type=int, help="server port (default %r)" % (SERVER_PORT,), default=SERVER_PORT, ) args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # extract the server address and port host = args.host port = args.port server_address = (host, port) if _debug: _log.debug(" - server_address: %r", server_address) # build the stack this_console = ConsoleClient() if _debug: _log.debug(" - this_console: %r", this_console) this_middle_man = MiddleMan() if _debug: _log.debug(" - this_middle_man: %r", this_middle_man) this_director = TCPClientDirector() if _debug: _log.debug(" - this_director: %r", this_director) bind(this_console, this_middle_man, this_director) bind(MiddleManASE(), this_director) # create a task manager for scheduled functions task_manager = TaskManager() if _debug: _log.debug(" - task_manager: %r", task_manager) # don't wait to connect this_director.connect(server_address) if _debug: _log.debug("running") run()
def main(): # check the version if (sys.version_info[:2] != (2, 5)): sys.stderr.write("Python 2.5 only\n") sys.exit(1) # parse the command line arguments parser = ArgumentParser(description=__doc__) parser.add_argument( "host", nargs='?', help="listening address of server or 'any' (default %r)" % (SERVER_HOST, ), default=SERVER_HOST, ) parser.add_argument( "port", nargs='?', type=int, help="server port (default %r)" % (SERVER_PORT, ), default=SERVER_PORT, ) args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # extract the server address and port host = args.host if host == "any": host = '' server_address = (host, args.port) if _debug: _log.debug(" - server_address: %r", server_address) # create a director listening to the address this_director = TCPServerDirector(server_address) if _debug: _log.debug(" - this_director: %r", this_director) # create an echo echo_master = EchoMaster() if _debug: _log.debug(" - echo_master: %r", echo_master) # bind everything together bind(echo_master, this_director) bind(MiddleManASE(), this_director) _log.debug("running") run() _log.debug("fini")
def main(): if _debug: main._debug("main") # parse the command line arguments args = ArgumentParser(description=__doc__).parse_args() if _debug: main._debug(" - args: %r", args) # suck in the test content text = sys.stdin.read() # parse it tag_list = ExtendedTagList(text) # dump it back out for tag in tag_list: tag.debug_contents()
def main(): # parse the command line arguments parser = ArgumentParser(description=__doc__) # add an argument for interval parser.add_argument('localaddr', type=str, help='local address of the BBMD', ) # add an argument for interval parser.add_argument('bdtentry', type=str, nargs='*', help='list of addresses of peers', ) # now parse the arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) local_address = Address(args.localaddr) if _debug: _log.debug(" - local_address: %r", local_address) # create a null client that will accept, but do nothing with upstream # packets from the BBMD null_client = NullClient() if _debug: _log.debug(" - null_client: %r", null_client) # create a BBMD, bound to the Annex J server on a UDP multiplexer bbmd = BIPBBMD(local_address) annexj = AnnexJCodec() multiplexer = UDPMultiplexer(local_address) # bind the layers together bind(null_client, bbmd, annexj, multiplexer.annexJ) # loop through the rest of the addresses for bdtentry in args.bdtentry: if _debug: _log.debug(" - bdtentry: %r", bdtentry) bdt_address = Address(bdtentry) bbmd.add_peer(bdt_address) if _debug: _log.debug(" - bbmd: %r", bbmd) _log.debug("running") run() _log.debug("fini")
def main(): # parse the command line arguments parser = ArgumentParser(description=__doc__) parser.add_argument( "--host", nargs='?', help="listening address of server", default=default_server_host, ) parser.add_argument( "--port", nargs='?', type=int, help="server port", default=default_server_port, ) args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # extract the server address and port host = args.host if host == "any": host = '' port = args.port server_address = (host, port) if _debug: _log.debug(" - server_address: %r", server_address) # create a director listening to the address this_director = TCPServerDirector(server_address) if _debug: _log.debug(" - this_director: %r", this_director) # create an echo echo_master = EchoMaster() if _debug: _log.debug(" - echo_master: %r", echo_master) # bind everything together bind(echo_master, this_director) bind(MiddleManASE(), this_director) _log.debug("running") run()
def main(): # check the version if (sys.version_info[:2] != (2, 5)): sys.stderr.write("Python 2.5 only\n") sys.exit(1) # parse the command line arguments parser = ArgumentParser(description=__doc__) parser.add_argument( "host", nargs='?', help="listening address of server or 'any' (default %r)" % (SERVER_HOST,), default=SERVER_HOST, ) parser.add_argument( "port", nargs='?', type=int, help="server port (default %r)" % (SERVER_PORT,), default=SERVER_PORT, ) args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # extract the server address and port host = args.host if host == "any": host = '' server_address = (host, args.port) if _debug: _log.debug(" - server_address: %r", server_address) # create a director listening to the address this_director = TCPServerDirector(server_address) if _debug: _log.debug(" - this_director: %r", this_director) # create an echo echo_master = EchoMaster() if _debug: _log.debug(" - echo_master: %r", echo_master) # bind everything together bind(echo_master, this_director) bind(MiddleManASE(), this_director) _log.debug("running") run() _log.debug("fini")
def main(): # parse the command line arguments parser = ArgumentParser(description=__doc__) # listener arguments parser.add_argument( "--host", type=str, help="address of host (default {!r})".format(SERVER_HOST), default=SERVER_HOST, ) parser.add_argument( "--port", type=int, help="server port (default {!r})".format(SERVER_PORT), default=SERVER_PORT, ) # connection timeout arguments parser.add_argument( "--idle-timeout", nargs='?', type=int, help="idle connection timeout", default=IDLE_TIMEOUT, ) args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # local IO functions bind(SimpleServer(), ModbusServer(port=args.port, idle_timeout=args.idle_timeout)) _log.debug("running") run() _log.debug("fini")
def main(): # parse the command line arguments parser = ArgumentParser(description=__doc__) # connection timeout paramters parser.add_argument( "--connect-timeout", nargs='?', type=int, help="idle connection timeout", default=CONNECT_TIMEOUT, ) parser.add_argument( "--idle-timeout", nargs='?', type=int, help="idle connection timeout", default=IDLE_TIMEOUT, ) # now parse the arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make a controller this_controller = ModbusClientController( connect_timeout=args.connect_timeout, idle_timeout=args.idle_timeout, ) if _debug: _log.debug(" - this_controller: %r", this_controller) # make a console this_console = ConsoleClient(this_controller) if _debug: _log.debug(" - this_console: %r", this_console) _log.debug("running") run() _log.debug("fini")
#!/bin/bash python """ This simple application takes a string form of a BACnet address from the command line and attempts to interpret it. """ import sys from bacpypes.consolelogging import ArgumentParser from bacpypes.pdu import Address # build a parser for the command line arguments parser = ArgumentParser(description=__doc__) parser.add_argument("address", help="address to interpret", ) # parse the command line arguments args = parser.parse_args() # try to interpret the address try: addr = Address(args.address) except Exception as err: print(err) sys.exit(1) # print the string form print(addr)
def main(): """ Main function, called when run as an application. """ global args, server_address # parse the command line arguments parser = ArgumentParser(description=__doc__) parser.add_argument( "host", nargs='?', help="address of host (default %r)" % (SERVER_HOST, ), default=SERVER_HOST, ) parser.add_argument( "port", nargs='?', type=int, help="server port (default %r)" % (SERVER_PORT, ), default=SERVER_PORT, ) parser.add_argument( "--hello", action="store_true", default=False, help="send a hello message", ) parser.add_argument( "--connect-timeout", nargs='?', type=int, help="idle connection timeout", default=CONNECT_TIMEOUT, ) parser.add_argument( "--idle-timeout", nargs='?', type=int, help="idle connection timeout", default=IDLE_TIMEOUT, ) args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # extract the server address and port host = args.host port = args.port server_address = (host, port) if _debug: _log.debug(" - server_address: %r", server_address) # build the stack this_console = ConsoleClient() if _debug: _log.debug(" - this_console: %r", this_console) this_middle_man = MiddleMan() if _debug: _log.debug(" - this_middle_man: %r", this_middle_man) this_director = TCPClientDirector( connect_timeout=args.connect_timeout, idle_timeout=args.idle_timeout, ) if _debug: _log.debug(" - this_director: %r", this_director) bind(this_console, this_middle_man, this_director) bind(MiddleManASE(), this_director) # create a task manager for scheduled functions task_manager = TaskManager() if _debug: _log.debug(" - task_manager: %r", task_manager) # don't wait to connect deferred(this_director.connect, server_address) # send hello maybe if args.hello: deferred(this_middle_man.indication, PDU(b'Hello, world!\n')) if _debug: _log.debug("running") run() if _debug: _log.debug("fini")
# install it self.install_task() def process_task(self): if _debug: PrairieDog._debug("process_task") sys.stdout.write("%d woof!\n" % (self.dog_number, )) # # __main__ # try: # parse the command line arguments parser = ArgumentParser(description=__doc__) # add an argument for seconds per dog parser.add_argument( 'seconds', metavar='N', type=int, nargs='+', help='number of seconds for each dog', ) # now parse the arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args)
# check for things if self.pParameter == self.pSetPoint: if _debug: SampleEventDetection._debug(" - parameter match") else: if _debug: SampleEventDetection._debug(" - parameter mismatch") bacpypes_debugging(SampleEventDetection) # # # # parse the command line arguments parser = ArgumentParser(usage=__doc__) args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # analog value 1 av1 = AnalogValueObject( objectIdentifier=('analogValue', 1), presentValue=75.3, ) if _debug: _log.debug(" - av1: %r", av1) # add a very simple monitor av1._property_monitors['presentValue'].append( partial(something_changed, "av1"), )
self.response(PDU(str(iocb.ioResponse) + '\n')) # if this aborted, pass that up too elif iocb.ioState == ABORTED: self.response(PDU(repr(iocb.ioError) + '\n')) else: raise RuntimeError, "invalid state: %r" % (iocb.ioState,) # # __main__ # try: # create a parser parser = ArgumentParser(description=__doc__) # add an option to pick a server parser.add_argument('--server', help="server name or address", default=SERVER, ) # add an option to pick a controller parser.add_argument('--controller', help="controller name", default=CONTROLLER, ) # parse the command line arguments args = parser.parse_args()
self.s2_mux = UDPMultiplexer(addr2) # bind the bottom layers bind(self.s2_bip, self.s2_annexj, self.s2_mux.annexJ) # bind the BIP stack to the local network self.nsap.bind(self.s2_bip, net2) # # __main__ # try: # parse the command line arguments parser = ArgumentParser(description=__doc__) # add an argument for interval parser.add_argument("addr1", type=str, help="address of first network") # add an argument for interval parser.add_argument("net1", type=int, help="network number of first network") # add an argument for interval parser.add_argument("addr2", type=str, help="address of second network") # add an argument for interval parser.add_argument("net2", type=int, help="network number of second network") # now parse the arguments args = parser.parse_args()
def process_io(self, iocb): if _debug: TestController._debug('process_io %r', iocb) # some random data rslt = random.random() * iocb.args[0] # send back the result self.complete_io(iocb, rslt) # # __main__ # try: # create a parser parser = ArgumentParser(description=__doc__) # add an option to pick a controller parser.add_argument('--controller', help="controller name", default=CONTROLLER, ) # parse the command line arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # this is an IO server IOServer()
def main(): # build a parser parser = ArgumentParser(description=__doc__) # add a --host option to override the default host address parser.add_argument( '--host', type=str, default=default_db_host, help='database host address', ) # add a --port option to override the default database parser.add_argument( '--db', type=str, default=default_db_db, help='database', ) # parse the command line arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # give the connection information to the db module db.db_connection_kwargs = { 'host': args.host, 'db': args.db, } if _debug: _log.debug(" - db_connection_kwargs: %r", db.db_connection_kwargs) # create the test table create_test_table() # test data test_data = [ (100, "a"), (110, "aa"), (111, "aaa"), (112, "aab"), (120, "ab"), (200, "b"), (210, "ba"), (211, "baa"), (212, "bab"), (220, "bb"), ] # insert the data for row_int, row_str in test_data: db.execute("insert into TestTable values (%s, %s)", (row_int, row_str)) # count the number of rows row_count = db.fetch_value("select count(*) from TestTable") if _debug: _log.debug(" - row_count: %r", row_count) assert row_count == len(test_data) # test for some specific values for row_int, row_str in random.sample(test_data, 3): if _debug: _log.debug(" - row_int, row_str: %r, %r", row_int, row_str) row_value = db.fetch_value("select row_int from TestTable where row_str = %s", (row_str,)) assert row_value == row_int # get some values row_ints = db.fetch_values("select row_int from TestTable where row_int < 200 order by row_int") if _debug: _log.debug(" - row_ints: %r", row_ints) assert row_ints == [100, 110, 111, 112, 120] # yield some objects for row_object in db.yield_objects("select * from TestTable where row_str >= %s", ('b',)): if _debug: _log.debug(" - row_object: %r, row_int=%r, row_str=%r", row_object, row_object.row_int, row_object.row_str) # drop the test table drop_test_table() # close the connections db.close_connections() if _debug: _log.debug("finally")
def main(): # parse the command line arguments parser = ArgumentParser( description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, ) # add an argument for interval parser.add_argument('addr1', type=str, help='address of first network', ) # add an argument for interval parser.add_argument('net1', type=int, help='network number of first network', ) # add an argument for interval parser.add_argument('addr2', type=str, help='address of second network', ) # add an argument for interval parser.add_argument('net2', type=int, help='network number of second network', ) # now parse the arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) local_address = Address(args.addr1) local_network = args.net1 vlan_address = Address(args.addr2) vlan_network = args.net2 # create the VLAN router, bind it to the local network router = VLANRouter(local_address, local_network) # create a VLAN vlan = Network() # create a node for the router, address 1 on the VLAN router_node = Node(Address(1)) vlan.add_node(router_node) # bind the router stack to the vlan network through this node router.nsap.bind(router_node, vlan_network) # device identifier is assigned from the address device_instance = vlan_network * 100 + int(args.addr2) _log.debug(" - device_instance: %r", device_instance) # make a vlan device object vlan_device = \ LocalDeviceObject( objectName="VLAN Node %d" % (device_instance,), objectIdentifier=('device', device_instance), maxApduLengthAccepted=1024, segmentationSupported='noSegmentation', vendorIdentifier=15, ) _log.debug(" - vlan_device: %r", vlan_device) # make the application, add it to the network vlan_app = VLANApplication(vlan_device, vlan_address) vlan.add_node(vlan_app.vlan_node) _log.debug(" - vlan_app: %r", vlan_app) # make a random value object ravo = RandomAnalogValueObject( objectIdentifier=('analogValue', 1), objectName='Device%d/Random1' % (device_instance,), ) _log.debug(" - ravo1: %r", ravo) # add it to the device vlan_app.add_object(ravo) _log.debug("running") run() _log.debug("fini")
if _debug: SampleEventDetection._debug(" - was not triggered") # check for things if self.pParameter == self.pSetPoint: if _debug: SampleEventDetection._debug(" - parameter match") else: if _debug: SampleEventDetection._debug(" - parameter mismatch") bacpypes_debugging(SampleEventDetection) # # # # parse the command line arguments parser = ArgumentParser(usage=__doc__) args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # analog value 1 av1 = AnalogValueObject( objectIdentifier=('analogValue', 1), presentValue=75.3, ) if _debug: _log.debug(" - av1: %r", av1) # add a very simple monitor av1._property_monitors['presentValue'].append( partial(something_changed, "av1"),
def main(): # parse the command line arguments parser = ArgumentParser( description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, ) # add an argument for interval parser.add_argument( 'addr1', type=str, help='address of first network', ) # add an argument for interval parser.add_argument( 'net1', type=int, help='network number of first network', ) # add an argument for interval parser.add_argument( 'addr2', type=str, help='address of second network', ) # add an argument for interval parser.add_argument( 'net2', type=int, help='network number of second network', ) # now parse the arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) local_address = Address(args.addr1) local_network = args.net1 vlan_address = Address(args.addr2) vlan_network = args.net2 # create the VLAN router, bind it to the local network router = VLANRouter(local_address, local_network) # create a VLAN vlan = Network(broadcast_address=LocalBroadcast()) # create a node for the router, address 1 on the VLAN router_node = Node(Address(1)) vlan.add_node(router_node) # bind the router stack to the vlan network through this node router.nsap.bind(router_node, vlan_network) # send network topology deferred(router.nse.i_am_router_to_network) # device identifier is assigned from the address device_instance = vlan_network * 100 + int(args.addr2) _log.debug(" - device_instance: %r", device_instance) # make a vlan device object vlan_device = \ LocalDeviceObject( objectName="VLAN Node %d" % (device_instance,), objectIdentifier=('device', device_instance), maxApduLengthAccepted=1024, segmentationSupported='noSegmentation', vendorIdentifier=15, ) _log.debug(" - vlan_device: %r", vlan_device) # make the application, add it to the network vlan_app = VLANApplication(vlan_device, vlan_address) vlan.add_node(vlan_app.vlan_node) _log.debug(" - vlan_app: %r", vlan_app) # make a random value object ravo = RandomAnalogValueObject( objectIdentifier=('analogValue', 1), objectName='Device%d/Random1' % (device_instance, ), ) _log.debug(" - ravo1: %r", ravo) # add it to the device vlan_app.add_object(ravo) _log.debug("running") run() _log.debug("fini")
def main(): global args # parse the command line arguments parser = ArgumentParser(description=__doc__) # arguments for first network parser.add_argument( 'lan', type=str, help='MQTT network name', ) parser.add_argument( 'addr1', type=str, help='address of first network', ) parser.add_argument( 'net1', type=int, help='network number of first network', ) # arguments for B/IP network parser.add_argument( 'addr2', type=str, help='address of second network', ) parser.add_argument( 'net2', type=int, help='network number of second network', ) # additional options for the MQTT client parser.add_argument( '--host', type=str, default=bacpypes_mqtt.default_broker_host, help='broker host address', ) parser.add_argument( '--port', type=int, default=bacpypes_mqtt.default_broker_port, help='broker port', ) parser.add_argument( '--keepalive', type=int, default=bacpypes_mqtt.default_broker_keepalive, help= "maximum period in seconds allowed between communications with the broker", ) # now parse the arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # create the router router = MQTT2IPRouter(args.lan, Address(args.addr1), args.net1, Address(args.addr2), args.net2) if _debug: _log.debug(" - router: %r", router) # start up the client router.s1_mse.startup() _log.debug("running") run() # shutdown the client router.s1_mse.shutdown() _log.debug("fini")
def setup_package(): global test_host, test_connection, test_database, test_collection, \ test_flush, test_dump # create an argument parser parser = ArgumentParser(description=__doc__) # add an option to select the host parser.add_argument('--host', help="connect to a host", default=os.getenv("MONGOTREE_HOST") or "localhost", ) # add an option to select the database parser.add_argument('--db', help="database", default=os.getenv("MONGOTREE_DB") or "test", ) # add an option to select the collection parser.add_argument('--collection', help="collection", default=os.getenv("MONGOTREE_COLLECTION") or "mongotree", ) # add a flush option parser.add_argument('--flush', help="flush the collection before running test", action='store_true', default=True, ) # add a dump option parser.add_argument('--dump', help="dump the collection after running test", action='store_true', default=True, ) # get the debugging args and parse them arg_str = os.getenv("MONGOTREE_DEBUG") or "" test_args = parser.parse_args(arg_str.split()) if _debug: setup_package._debug("setup_package") if _debug: setup_package._debug(" - test_args: %r", test_args) # save the host test_host = test_args.host if _debug: setup_package._debug(" - test_host: %r", test_host) # create a connection test_connection = pymongo.MongoClient(test_args.host) if _debug: setup_package._debug(" - test_connection: %r", test_connection) # reference a database test_database = test_connection[test_args.db] if _debug: setup_package._debug(" - test_database: %r", test_database) # reference a collection test_collection = test_database[test_args.collection] if _debug: setup_package._debug(" - test_collection: %r", test_collection) # flush before each case test_flush = test_args.flush if _debug: setup_package._debug(" - test_flush: %r", test_flush) # dump after each case test_dump = test_args.dump if _debug: setup_package._debug(" - test_dump: %r", test_dump) if _debug: setup_package._debug(" - periodic executors: %r", pymongo.periodic_executor._EXECUTORS)
def main(): global args, this_application # parse the command line arguments parser = ArgumentParser( description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, ) # add an argument for interval parser.add_argument( "addr1", type=str, help="address of first network", ) # add an argument for interval parser.add_argument( "net1", type=int, help="network number of first network", ) # add an argument for interval parser.add_argument( "net2", type=int, help="network number of second network", ) # add an argument for how many virtual devices parser.add_argument( "--count", type=int, help="number of virtual devices", default=1, ) # add an argument for how many virtual devices parser.add_argument( "--rpm", help="enable read property multiple", action="store_true", ) # add an argument for including the property list parser.add_argument( "--plist", help="enable property list property", action="store_true", ) # now parse the arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) local_address = Address(args.addr1) local_network = args.net1 vlan_network = args.net2 # create the VLAN router, bind it to the local network router = VLANRouter(local_address, local_network) # create a VLAN vlan = Network(broadcast_address=LocalBroadcast()) # create a node for the router, address 1 on the VLAN router_addr = Address(1) router_node = Node(router_addr) vlan.add_node(router_node) # bind the router stack to the vlan network through this node router.nsap.bind(router_node, vlan_network, router_addr) # send network topology deferred(router.nse.i_am_router_to_network) # add the dynamic property list if args.plist: RandomAnalogValueObject.properties.append(CurrentPropertyList()) # register it now that all its properties are defined register_object_type(RandomAnalogValueObject, vendor_id=999) # console is the first device device_number = 2 device_instance = vlan_network * 100 + device_number _log.debug(" - console device_instance: %r", device_instance) # make a vlan device object vlan_device = LocalDeviceObject( objectName="VLAN Console Node %d" % (device_instance, ), objectIdentifier=("device", device_instance), maxApduLengthAccepted=1024, segmentationSupported="noSegmentation", vendorIdentifier=15, ) _log.debug(" - vlan_device: %r", vlan_device) vlan_address = Address(device_number) _log.debug(" - vlan_address: %r", vlan_address) # make the console application, add it to the network this_application = VLANConsoleApplication(vlan_device, vlan_address) vlan.add_node(this_application.vlan_node) _log.debug(" - this_application: %r", this_application) # make a console this_console = VLANConsoleCmd() if _debug: _log.debug(" - this_console: %r", this_console) # make a random value object ravo = RandomAnalogValueObject( objectIdentifier=("analogValue", 1), objectName="Random-1-%d" % (device_instance, ), ) _log.debug(" - ravo: %r", ravo) # add it to the device this_application.add_object(ravo) # make some more devices for device_number in range(3, 3 + args.count - 1): # device identifier is assigned from the address device_instance = vlan_network * 100 + device_number _log.debug(" - device_instance: %r", device_instance) # make a vlan device object vlan_device = LocalDeviceObject( objectName="VLAN Node %d" % (device_instance, ), objectIdentifier=("device", device_instance), maxApduLengthAccepted=1024, segmentationSupported="noSegmentation", vendorIdentifier=15, ) _log.debug(" - vlan_device: %r", vlan_device) vlan_address = Address(device_number) _log.debug(" - vlan_address: %r", vlan_address) # make the application, add it to the network vlan_app = VLANApplication(vlan_device, vlan_address) vlan.add_node(vlan_app.vlan_node) _log.debug(" - vlan_app: %r", vlan_app) # make a random value object ravo = RandomAnalogValueObject( objectIdentifier=("analogValue", 1), objectName="Random-1-%d" % (device_instance, ), ) _log.debug(" - ravo: %r", ravo) # add it to the device vlan_app.add_object(ravo) # enable sleeping will help with threads enable_sleeping() _log.debug("running") run() _log.debug("fini")
from bacpypes.apdu import Error from bacpypes.errors import ExecutionError from csv import DictReader import logging #---------------------------------------------------------------------------# # configure the service logging #---------------------------------------------------------------------------# # some debugging _debug = 0 _log = ModuleLogger(globals()) import struct parser = ArgumentParser(description='Run a test pymodbus driver') parser.add_argument('config', help='device registry configuration') parser.add_argument('interface', help='interface address and optionally the port for the device to listen on') args = parser.parse_args() MODBUS_REGISTER_SIZE = 2 class Register(object): def __init__(self, point_name, instance_number, object_type, property_name, read_only): self.read_only = read_only self.register_type = "byte" self.property_name = property_name self.object_type = object_type self.instance_number = int(instance_number) self.point_name = point_name
self.bip = BIPBBMD(local_address) self.annexj = AnnexJCodec() self.mux = UDPMultiplexer(local_address) # bind the bottom layers bind(self.bip, self.annexj, self.mux.annexJ) # bind the BIP stack to the local network self.nsap.bind(self.bip, local_network, local_address) # # __main__ # # parse the command line arguments parser = ArgumentParser(description=__doc__) # add an argument for interval parser.add_argument('addr1', type=str, help='address of first network', ) # add an argument for interval parser.add_argument('net1', type=int, help='network number of first network', ) # add an argument for interval parser.add_argument('addr2', type=str, help='address of second network', )
pkt.deviceInstanceRangeHighLimit, ) whoIsTraffic[key] += 1 # check for I-Am elif isinstance(pkt, IAmRequest): key = (pkt.pduSource, pkt.iAmDeviceIdentifier[1]) iAmTraffic[key] += 1 # # __main__ # # parse the command line arguments parser = ArgumentParser(description=__doc__) parser.add_argument("-s", "--source", nargs="?", type=str, help="source address") parser.add_argument( "-d", "--destination", nargs="?", type=str, help="destination address" ) parser.add_argument("--host", nargs="?", type=str, help="source or destination") parser.add_argument("pcap", nargs="+", type=str, help="pcap file(s)") args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # interpret the arguments if args.source:
def main(): """ Main function, called when run as an application. """ global server_address # parse the command line arguments parser = ArgumentParser(description=__doc__) parser.add_argument( "host", nargs='?', help="address of host (default %r)" % (SERVER_HOST,), default=SERVER_HOST, ) parser.add_argument( "port", nargs='?', type=int, help="server port (default %r)" % (SERVER_PORT,), default=SERVER_PORT, ) parser.add_argument( "--hello", action="store_true", default=False, help="send a hello message", ) args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # extract the server address and port host = args.host port = args.port server_address = (host, port) if _debug: _log.debug(" - server_address: %r", server_address) # build the stack this_console = ConsoleClient() if _debug: _log.debug(" - this_console: %r", this_console) this_middle_man = MiddleMan() if _debug: _log.debug(" - this_middle_man: %r", this_middle_man) this_director = TCPClientDirector() if _debug: _log.debug(" - this_director: %r", this_director) bind(this_console, this_middle_man, this_director) bind(MiddleManASE(), this_director) # create a task manager for scheduled functions task_manager = TaskManager() if _debug: _log.debug(" - task_manager: %r", task_manager) # don't wait to connect deferred(this_director.connect, server_address) # send hello maybe if args.hello: deferred(this_middle_man.indication, PDU(xtob('68656c6c6f0a'))) if _debug: _log.debug("running") run() if _debug: _log.debug("fini")
if pdu.pduSource == local_unicast_tuple: sys.stdout.write("received broadcast %r from self\n" % (line,)) else: sys.stdout.write("received broadcast %r from %s\n" % ( line, pdu.pduSource, )) # # __main__ # try: # parse the command line arguments parser = ArgumentParser(description=__doc__) parser.add_argument("address", help="address of socket", ) parser.add_argument("--nobroadcast", action="store_true", dest="noBroadcast", default=False, help="do not create a broadcast socket", ) args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args)
# install it self.install_task() def process_task(self): if _debug: PrairieDog._debug("process_task") sys.stdout.write("%d woof!\n" % (self.dog_number,)) # # __main__ # try: # parse the command line arguments parser = ArgumentParser(description=__doc__) # add an argument for seconds per dog parser.add_argument('seconds', metavar='N', type=int, nargs='+', help='number of seconds for each dog', ) # now parse the arguments args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) # make some dogs for i, sec in enumerate(args.seconds): dog = PrairieDog(i, sec * 1000)
from csv import DictReader import logging from utils import createDaemon #---------------------------------------------------------------------------# # configure the service logging #---------------------------------------------------------------------------# # some debugging _debug = 0 _log = ModuleLogger(globals()) import struct parser = ArgumentParser(description='Run a test pymodbus driver') parser.add_argument('config', help='device registry configuration') parser.add_argument('interface', help='interface address and optionally the port and subnet mask for the device to listen on') parser.add_argument('--no-daemon', help='do not create a daemon process', action='store_true') parser.add_argument('--device-id', help='specify the BACnet device id of the device.', type=int, default=1000) args = parser.parse_args() class Register(object): def __init__(self, point_name, instance_number, object_type, property_name, read_only): self.read_only = read_only self.register_type = "byte" self.property_name = property_name self.object_type = object_type self.instance_number = int(instance_number) self.point_name = point_name
self.annexj = AnnexJCodec() self.mux = UDPMultiplexer(local_address) # bind the bottom layers bind(self.bip, self.annexj, self.mux.annexJ) # bind the BIP stack to the local network self.nsap.bind(self.bip, local_network, local_address) # # __main__ # # parse the command line arguments parser = ArgumentParser(description=__doc__) # add an argument for interval parser.add_argument( 'addr1', type=str, help='address of first network', ) # add an argument for interval parser.add_argument( 'net1', type=int, help='network number of first network', )
def main(): global local_unicast_tuple, local_broadcast_tuple # parse the command line arguments parser = ArgumentParser(usage=__doc__) parser.add_argument("address", help="address of socket", ) parser.add_argument("--nobroadcast", action="store_true", dest="noBroadcast", default=False, help="do not create a broadcast socket", ) args = parser.parse_args() if _debug: _log.debug("initialization") if _debug: _log.debug(" - args: %r", args) if args.address == "any": local_unicast_tuple = ('', 47808) local_broadcast_tuple = ('255.255.255.255', 47808) elif args.address.startswith("any:"): port = int(args.address[4:]) local_unicast_tuple = ('', port) local_broadcast_tuple = ('255.255.255.255', port) else: address = Address(args.address) if _debug: _log.debug(" - local_address: %r", address) local_unicast_tuple = address.addrTuple local_broadcast_tuple = address.addrBroadcastTuple if _debug: _log.debug(" - local_unicast_tuple: %r", local_unicast_tuple) if _debug: _log.debug(" - local_broadcast_tuple: %r", local_broadcast_tuple) console = ConsoleClient() middle_man = MiddleMan() unicast_director = UDPDirector(local_unicast_tuple) bind(console, middle_man, unicast_director) if args.noBroadcast: _log.debug(" - skipping broadcast") elif local_unicast_tuple == local_broadcast_tuple: _log.debug(" - identical unicast and broadcast tuples") elif local_broadcast_tuple[0] == '255.255.255.255': _log.debug(" - special broadcast address only for sending") else: broadcast_receiver = BroadcastReceiver() broadcast_director = UDPDirector(local_broadcast_tuple, reuse=True) bind(broadcast_receiver, broadcast_director) _log.debug("running") run() _log.debug("fini")