Updated link example

This commit is contained in:
Mark Qvist 2020-05-14 16:22:49 +02:00
parent 343f439ad9
commit bbf79e1133

View File

@ -75,10 +75,13 @@ def client_disconnected(link):
def server_packet_received(message, packet): def server_packet_received(message, packet):
global latest_client_link global latest_client_link
# When data is received over any active link,
# it will all be directed to the last client
# that connected.
text = message.decode("utf-8") text = message.decode("utf-8")
RNS.log("Received data on the link: "+text) RNS.log("Received data on the link: "+text)
reply_text = "I got \""+text+"\" from you" reply_text = "I received \""+text+"\" over the link"
reply_data = reply_text.encode("utf-8") reply_data = reply_text.encode("utf-8")
RNS.Packet(latest_client_link, reply_data).send() RNS.Packet(latest_client_link, reply_data).send()