From e8fb435f0037807d810cef330e5b9780ade3f5ca Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Thu, 20 May 2021 13:37:48 +0200 Subject: [PATCH] Updated link example --- Examples/Link.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Examples/Link.py b/Examples/Link.py index 6eb2530..1b9ec2f 100644 --- a/Examples/Link.py +++ b/Examples/Link.py @@ -181,8 +181,18 @@ def client_loop(): # If not, send the entered text over the link if text != "": data = text.encode("utf-8") - RNS.Packet(server_link, data).send() + if len(data) <= RNS.Link.MDU: + RNS.Packet(server_link, data).send() + else: + RNS.log( + "Cannot send this packet, the data size of "+ + str(len(data))+" bytes exceeds the link packet MDU of "+ + str(RNS.Link.MDU)+" bytes", + RNS.LOG_ERROR + ) + except Exception as e: + RNS.log("Error while sending data over the link: "+str(e)) should_quit = True server_link.teardown()