someone pressed enter on both machines. that was the frame.
the receiver hears the room all the time
where does it start? where does it end? the numbers do not say.
a bit stream without a frame means nothing
bits become a message when both sides know where it starts, where it ends and what it means.
what a running receiver needs
where it starts
where it ends
what to do when something goes wrong
round one: i send, you write down what you see
what the room wrote down
red green green blue red red green
where the message was
somewhere in there. nobody could say where.
no agreement, no chance. that is what your receiver sees.
round two: same game, three times
what changed
every message started the same way
when the room noticed
on the second one
the third time, the room saw it coming.
you just invented the preamble
a preamble carries no information. it only says "from here on".
one red is not a start
longer and more regular: rarer by chance. price: a few symbols per message.
what the frame costs
the frame costs the same per message. short messages pay most.
what if the data looks like the start
your specification must answer this. there is more than one good answer.
round three: two messages, back to back
what the room proposed
say up front how long it is
and
send an agreed sign at the end
both answers are right. that is why this is a decision.
two answers, two price tags
neither is the right one. you pick one and write it down.
the same reading means different things
the reading does not decide. the state does.
a state is only a variable
state = "waiting"
message = ""
while True:
symbol = read_symbol()
if state == "waiting":
if preamble_complete(symbol):
state = "reading"
elif state == "reading":
if symbol == END_MARK:
print(message) state = "waiting"
message = "" else:
message = message + symbol
forget the way back, and your receiver can read exactly one message.
when the end never comes
it does not lose this message. it loses every message from now on.
a protocol is an agreement someone else can implement
symbols, start, end, time, the failure case. all of it before the first bit.
the test for your specification
cross out everything you know but did not write down. is the rest enough?
what happens next
this week: your own frame, written down
next week: someone else builds your receiver
then: one frame for the whole class
a standard is not a technical necessity. it is an agreement.