import argparse from Serv import Serv from Cli import Cli from Api import Api parser = argparse.ArgumentParser() parser.add_argument('port', type=int, nargs='?', default=4444) args = parser.parse_args() if __name__ == '__main__': serv = Serv(args.port) print("Started the node on " + serv.addr) api = Api(serv) cli = Cli(api) serv.start() cli.start() ''' //Checklist *# mesh network *# join operation *# New machines join the network by sending a join message to one of the machines already in the network. *# The address of the new host is thereupon propagated in the network. *# Hosts also need to be able to sign off from the network again. *# One node in the network needs to be elected as master node. The master node stores a string variable that is initially empty. *# Start message *# The master node needs to be elected by the Bully algorithm. *# In case the current master node signs off or fails a new master has to be elected. *# The process takes 20 seconds. During this time all the nodes in the network do the following: LOOP a) Wait a random amount of time