Updated Echo example

This commit is contained in:
Mark Qvist 2018-04-25 12:23:39 +02:00
parent f3b195b41e
commit 58431ee244

View File

@ -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")