From 58431ee244e3b74ab59a9537fa3b10d780517146 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Wed, 25 Apr 2018 12:23:39 +0200 Subject: [PATCH] Updated Echo example --- Examples/Echo.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Examples/Echo.py b/Examples/Echo.py index 452cfbe..c90d97e 100644 --- a/Examples/Echo.py +++ b/Examples/Echo.py @@ -14,6 +14,11 @@ import RNS # them all within the app namespace "example_utilities" APP_NAME = "example_utilitites" + +########################################################## +#### Server Part ######################################### +########################################################## + # This initialisation is executed when the users chooses # to run as a server def server(configpath): @@ -69,6 +74,10 @@ def server_callback(message, packet): RNS.log("Received packet from echo client, proof sent") +########################################################## +#### Client Part ######################################### +########################################################## + # This initialisation is executed when the users chooses # to run as a client def client(destination_hexhash, configpath, timeout=None): @@ -163,9 +172,14 @@ def packet_timed_out(receipt): if receipt.status == RNS.PacketReceipt.FAILED: RNS.log("Packet "+RNS.prettyhexrep(receipt.hash)+" timed out") + +########################################################## +#### Program Startup ##################################### +########################################################## + # This part of the program gets run at startup, -# and parses input of from the user, and then -# starts up the desired program mode. +# and parses input from the user, and then starts +# the desired program mode. if __name__ == "__main__": try: parser = argparse.ArgumentParser(description="Simple echo server and client utility")