Пример #1
0
                         numberOfNodesPerRing=4,
                         ownIdentifier="PhyMaster")
    __debugOut.debugOutSource("Main", __debugOut.srcComputer, __debugOut.INFO,
                              "Initiating PhyMaster done \n")

    # We are initiating one computer
    __debugOut.debugOutSource("Main", __debugOut.srcComputer, __debugOut.INFO,
                              "Instanciation computer 1")
    computer1 = Computer(ownIdentifier="A",
                         masterHost=masterHostIp,
                         baseport=10000,
                         statusUpdateSeconds=10)
    # Get the global debug messages from the server for the graphical interface (this shall only be done for one computer)
    computer1.enableGlobalDebug()
    # Configure the delay in each layer and before sending the packet out of the computer (for debugging)
    computer1.debugConfigureNetworkstackDelay(sendDelay=0.2, layerDelay=0.2)

    __debugOut.debugOutSource("Main", __debugOut.srcComputer, __debugOut.INFO,
                              "Instanciation computer 2")
    computer2 = Computer(ownIdentifier="B",
                         masterHost=masterHostIp,
                         baseport=10000,
                         statusUpdateSeconds=10)
    computer2.debugConfigureNetworkstackDelay(sendDelay=0.2, layerDelay=0.2)

    # We may want to have a third computer somewhen
    # In this case, we may even use the alternative network stack (networkStackNumber=1) which may come in handy to combine two implementations in one trial
    if True:
        __debugOut.debugOutSource("Main", __debugOut.srcComputer,
                                  __debugOut.INFO, "Instanciation computer 3")
        if True:
Пример #2
0
    __debugOut.setDebugLevelForLayer(5, __debugOut.INFO)
    __debugOut.setDebugLevelForLayer(6, __debugOut.INFO)

    # This starts the graphical user interface
    # Computers (Nodes) are added automatically unless contained in ignoreComputers
    # The layerSelection determines the layers that are displayed graphically
    masterHostIp = '127.0.0.1'
    debugGui = DebugGui(ignoreComputer=["PhyMaster", "Main"],
                        layerSelection=[1, 2, 16, 15, 14, 13, 12, 11],
                        macosTkinterWorkaround=macosTkinterWorkaround)

    __debugOut.debugOutSource("Main", __debugOut.srcComputer, __debugOut.INFO,
                              "Instanciation computer 1")
    computer1 = Computer(ownIdentifier="C",
                         masterHost=masterHostIp,
                         baseport=10000,
                         statusUpdateSeconds=10)
    computer1.debugConfigureNetworkstackDelay(sendDelay=3, layerDelay=1)
    computer1.enableGlobalDebug()

    time.sleep(3)

    if False:
        computer1.initiateToken()

#    time.sleep(10)
#    os._exit(0)

    if macosTkinterWorkaround:
        debugGui.launch()