match = re.match("plist", do) if match: pprint.pprint(thisPeer.listPeers()) continue match = re.match("hello", do) if match: thisPeer.multicast() thisPeer.startListeningForMulticast() thisPeer.startFindingNeighbours() thisPeer.startLookingForDeadNeighbours() continue match = re.match(r"hello\s((\d+\.\d+\.\d+\.\d+\:\d+)|localhost\:\d+)", do) if match: thisPeer.sayHello(match.group(1)) thisPeer.multicast() thisPeer.startListeningForMulticast() thispeer.startFindingNeighbours() thisPeer.startLookingForDeadNeighbours() continue # NEIGHBOURS match = re.match(r"nlist( -o (.*))?$", do) if match: if match.group(2): f = open(match.group(2), 'w') f.write(formatMap(thisPeer.getNeighbours([args.name]))) f.close() else: