mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-11-22 21:50:18 +00:00
Updated Echo example
This commit is contained in:
parent
f3b195b41e
commit
58431ee244
@ -14,6 +14,11 @@ import RNS
|
|||||||
# them all within the app namespace "example_utilities"
|
# them all within the app namespace "example_utilities"
|
||||||
APP_NAME = "example_utilitites"
|
APP_NAME = "example_utilitites"
|
||||||
|
|
||||||
|
|
||||||
|
##########################################################
|
||||||
|
#### Server Part #########################################
|
||||||
|
##########################################################
|
||||||
|
|
||||||
# This initialisation is executed when the users chooses
|
# This initialisation is executed when the users chooses
|
||||||
# to run as a server
|
# to run as a server
|
||||||
def server(configpath):
|
def server(configpath):
|
||||||
@ -69,6 +74,10 @@ def server_callback(message, packet):
|
|||||||
RNS.log("Received packet from echo client, proof sent")
|
RNS.log("Received packet from echo client, proof sent")
|
||||||
|
|
||||||
|
|
||||||
|
##########################################################
|
||||||
|
#### Client Part #########################################
|
||||||
|
##########################################################
|
||||||
|
|
||||||
# This initialisation is executed when the users chooses
|
# This initialisation is executed when the users chooses
|
||||||
# to run as a client
|
# to run as a client
|
||||||
def client(destination_hexhash, configpath, timeout=None):
|
def client(destination_hexhash, configpath, timeout=None):
|
||||||
@ -163,9 +172,14 @@ def packet_timed_out(receipt):
|
|||||||
if receipt.status == RNS.PacketReceipt.FAILED:
|
if receipt.status == RNS.PacketReceipt.FAILED:
|
||||||
RNS.log("Packet "+RNS.prettyhexrep(receipt.hash)+" timed out")
|
RNS.log("Packet "+RNS.prettyhexrep(receipt.hash)+" timed out")
|
||||||
|
|
||||||
|
|
||||||
|
##########################################################
|
||||||
|
#### Program Startup #####################################
|
||||||
|
##########################################################
|
||||||
|
|
||||||
# This part of the program gets run at startup,
|
# This part of the program gets run at startup,
|
||||||
# and parses input of from the user, and then
|
# and parses input from the user, and then starts
|
||||||
# starts up the desired program mode.
|
# the desired program mode.
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
try:
|
try:
|
||||||
parser = argparse.ArgumentParser(description="Simple echo server and client utility")
|
parser = argparse.ArgumentParser(description="Simple echo server and client utility")
|
||||||
|
Loading…
Reference in New Issue
Block a user