alexnjh / CE4013-Distributed-System

0 stars 0 forks source link

Add booking message format #14

Open alexnjh opened 3 years ago

alexnjh commented 3 years ago

| Preamble (2 bytes) | Length of message (2 bytes) | length of type string=10 | "AddBooking" (10 bytes) | Length of string (x bytes) | data (x bytes) |

itachi1706 commented 3 years ago

AddBooking in bytes: 416464426f6f6b696e67

@alexnjh i see you have 0x08 (backspace) and 0x0a (LF) at the start and end of string (from https://github.com/alexnjh/CE4013-Distributed-System/blob/main/server/messagesocket/header.go#L10), is that like needed to pad or sth?

alexnjh commented 3 years ago

0x08 is the length of the type string not backspace although i think the length is suppose to be 0x05 = Error (5 bytes)

I correct it in the next commit

The LF can remove i think i left it in there the LF is not needed i think just that i nvr remove when testing the printing of the string

itachi1706 commented 3 years ago

yeah i realize it was length of string, I was also confused why its 08 hahah

your 0a is the length of message I think. length of 10? I implement for mine is to just get the payload length again

itachi1706 commented 3 years ago

Update AddBooking message format

| Preamble (2 bytes) | Length of message (2 bytes) | length of type string=10 | "AddBooking" (10 bytes) | Length of string (x bytes) | data (x bytes) |
itachi1706 commented 3 years ago

Data format

booker name length (1 byte) | booker name (x bytes) | start date/time (7 bytes) | end date/time (7 bytes) | facility name length (1 byte) | facility name (x bytes)

@chee96