800 likes | 1.02k Views
Lab 2: Admin details. Lab 2 is out! Due: November 4th, 12 noon November 6th, 12 noon (90 % cap) Assignment and starter code online Start early ! On average, took students 14 hours to complete Lab 2 last year. Functionality. Functionality. Write an application that:
E N D
Lab 2: Admin details • Lab 2 is out! • Due: • November 4th, 12 noon • November 6th, 12 noon (90% cap) • Assignment and starter code online • Start early! On average, took students 14 hours to complete Lab 2 last year
Functionality Write an application that: • Takes in data from one host
Functionality Write an application that: • Takes in data from one host • Turns those data into packets
Functionality Write an application that: • Takes in data from one host • Turns those data into packets • Transmits those packets reliably and in-order to the other host
Why the Internet isn't just "tubes" • A packet can be corrupted • A packet can be delayed • A packet can be dropped • A packet can be duplicated
corrupted delayed dropped duplicated Please transfer $100 from my bank account to Phil's
corrupted delayed dropped duplicated Please transfer $100 from my bank account to Phil's Please transfer $14837135 from my bank account to Phil's
corrupted delayed dropped duplicated Please deposit $100 into my account Please transfer $100 from my bank account to Phil's
corrupted delayed dropped duplicated Please transfer $100 from my bank account to Phil's Please deposit $100 into my account Please transfer $100 from my bank account to Phil's Please deposit $100 into my account
corrupted delayed dropped duplicated Please transfer $100 from my bank account to Phil's
corrupted delayed dropped duplicated Please transfer $100 from my bank account to Phil's
corrupted delayed dropped duplicated Please transfer $100 from my bank account to Phil's Please transfer $100 from my bank account to Phil's Please transfer $100 from my bank account to Phil's
Tools for ordered, reliable streams • Checksums • Sequence numbers • Acknowledgments • Timeouts
cksums seq nos acks timeouts Hash: cksum(data) integer
cksums seq nos acks timeouts Hash: cksum(data) integer cksum("a") 1
cksums seq nos acks timeouts Please transfer $100 from my bank account to Phil's Please transfer $14837135 from my bank account to Phil's
cksums seq nos acks timeouts Tag packet with checksum before sending Please transfer $100 from my bank account to Phil's Please transfer $14837135 from my bank account to Phil's
cksums seq nos acks timeouts Tag packet with checksum before sending Please transfer $100 from my bank account to Phil's Please transfer $14837135 from my bank account to Phil's cksum("Please ...") cksum("Please ...") Please transfer $100 from my bank account to Phil's Please transfer $14837135 from my bank account to Phil's
cksums seq nos acks timeouts Note: cksum("Please transfer ... $100 ...") cksum("Please transfer ... $14837135 ...")
cksums seq nos acks timeouts Note: cksum("Please transfer ... $100 ...") cksum("Please transfer ... $14837135 ...") cksum("Please ...") cksum("Please ...") Please transfer $100 from my bank account to Phil's Please transfer $14837135 from my bank account to Phil's
cksums seq nos acks timeouts Monotonically increasing number appended to packet
cksums seq nos acks timeouts Monotonically increasing number appended to packet Please transfer $100 from my bank account to Phil's Please transfer $100 from my bank account to Phil's Please transfer $100 from my bank account to Phil's
cksums seq nos acks timeouts Monotonically increasing number appended to packet Please transfer $100 from my bank account to Phil's Please transfer $100 from my bank account to Phil's Seq no: 152 Seq no: 152 Please transfer $100 from my bank account to Phil's Seq no: 152
cksums seq nos acks timeouts Monotonically increasing number appended to packet Please transfer $100 from my bank account to Phil's Please transfer $100 from my bank account to Phil's Seq no: 152 Seq no: 152 Please transfer $100 from my bank account to Phil's Seq no: 152
cksums seq nos acks timeouts Monotonically increasing number appended to packet Please transfer $100 from my bank account to Phil's Please transfer $100 from my bank account to Phil's Seq no: 152 Seq no: 152 Please transfer $100 from my bank account to Phil's Seq no: 152
cksums seq nos acks timeouts Monotonically increasing number appended to packet Please transfer $100 from my bank account to Phil's Please transfer $100 from my bank account to Phil's Seq no: 152 Seq no: 152 Please transfer $100 from my bank account to Phil's Seq no: 152 Sender: Last sequence number sent (and last sequence number ack-d) Receiver: Last sequence number received
cksums seq nos acks timeouts Receiver acknowledges received packets If sender does not receive ack, retransmits
cksums seq nos acks timeouts Receiver acknowledges received packets If sender does not receive ack, retransmits Please transfer $100 from my bank account to Phil's Seq no: 152
cksums seq nos acks timeouts Receiver acknowledges received packets If sender does not receive ack, retransmits Please transfer $100 from my bank account to Phil's Please transfer $100 from my bank account to Phil's Seq no: 152 Seq no: 152 Please transfer $100 from my bank account to Phil's Seq no: 152
cksums seq nos acks timeouts Receiver acknowledges received packets If sender does not receive ack, retransmits Please transfer $100 from my bank account to Phil's Please transfer $100 from my bank account to Phil's Seq no: 152 Seq no: 152 Please transfer $100 from my bank account to Phil's Seq no: 152 Ack no: 153
Checksums Sequence numbers Acknowledgments Timeouts Duplicate Corrupt Delay Drop
Stop and wait If you have a Sender and a Receiver: • Sender sends a data message. • Sender waits until receiver acknowledges reception • If Sender receives ack, sends its next available packet • If Sender does not receive ack, the Sender re-transmits the data that had not been acknowledged
Difficulties • Conceptual • The "little" things
Conceptual: Event-based code • What are the events? • What parts of code map to events? • How to respond to events? • How track state in? When transition between states?
Events • Receive data packet • Receive ack packet • Input goes from empty to having data • Output goes from full to having room • Timer expires • Create a new connection ------ • Receive shutdown from opposite end • Receive shutdown from input
Conceptual: Event-based code • What are the events? • What parts of code map to events? • How to respond to events? • How track state in? When transition between states?
Events • Create a new connection rel_create • Receive data packet • Receive ack packet rel_recvpkt • Input goes from empty to having data rel_read • Output goes from full to having room rel_output • Timer expires rel_timer
Conceptual: Event-based code • What are the events? • What parts of code map to events? • How to respond to events? • How track state in? When transition between states?
Events • Create a new connection rel_create • Receive data packet • Receive ack packet rel_recvpkt • Input goes from empty to having data rel_read • Output goes from full to having room rel_output • Timer expires rel_timer