From c7ed16650ca3b8be8dbdce024dfbd24ad2b34e75 Mon Sep 17 00:00:00 2001
From: rj3-morgan <ryan5.morgan@live.uwe.ac.uk>
Date: Thu, 7 Apr 2022 23:19:01 +0000
Subject: [PATCH] Better explaination for display_packet function.

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 1e1c481..cbcede3 100644
--- a/README.md
+++ b/README.md
@@ -38,7 +38,7 @@ This function is for displaying the contents of a packet. The packet would be pa
 
 > E.g. display_packet(“\n\x00*\x00!\x00\xcb;Welcome to IoT UDP Server”)). 
 
-Each part of the packet is sliced up (using python slices) and decoded to bytes for it to be printed/displayed.
+Each part of the packet is sliced up (using python slices) and decoded to bytes for it to be printed/displayed. The first 8 bytes of the packet are for the packet header. Bytes 1/2 are for the source port, 3/4 is for the destination port, 5/6 is for the length of the payload, and bytes 7/8 is for the checksum for the packet. Anything after 8 bytes is for the payload. The payload bytes is the payload length + 8, after the first 8 bytes (packet header).
 
 #### send_packet() 
 This function constructs a UDP packet and sends it to the server. A UDP packet is made by getting all the parts of a packet in bytes and adding them together in a specific order (e.g. destination port + source port + length + checksum + message). The length is calculated from the length of a message. Once a packet is made, the bytes are encoded using the base64 library and sent off to the server using the websocket library. The websocket, destination port, source port, and message are passed into the function as parameters. 
-- 
GitLab