f = open(match.group(3), 'w') f.write(formatMap(thisPeer.getAllNeighbours())) f.close() else: print(formatMap(thisPeer.getNeighbours(match.group(1).split(" ")))) continue # FLOOD SEARCH match = re.match(r"find (\S+)\s*(\S*)", do) if match: if len(match.group(2)) > 0: TTL = int(match.group(2)) else: TTL = 5 print('Find result: '+str(thisPeer.simpleFloodFind(match.group(1), TTL))) continue match = re.match(r"ringfind (.+)", do) if match: print('Find result: '+str(thisPeer.expandingRingFind(match.group(1)))) continue match = re.match(r"get (.+)", do) if match: print('Get result: '+str(thisPeer.get(match.group(1)))) continue # K WALKER SEARCH match = re.match(r"kfind (\S+)\s*(\S*)\s*(\S*)$", do)