80 likes | 265 Vues
TCP Lab. Src Port. Dest Port. SequenceNum. Acknowledgement. 0. HdrLen. Flags. Advertised. (4). (6). (6). Window. CheckSum. UrgPtr. options. (variable). data. Overview. Create TCP headers and send through IP Sliding Window. Steps. Get the basic header working
E N D
Src Port Dest Port SequenceNum Acknowledgement 0 HdrLen Flags Advertised (4) (6) (6) Window CheckSum UrgPtr options (variable) data Overview • Create TCP headers and send through IP • Sliding Window
Steps • Get the basic header working • Get Stop and Wait to work • Send a packet • If no response in 10 seconds, resend • Add code to allow several segments to be transmitted before ACK
Yes Yes Ack with sequence=111 means we have received everything before 111 and expect 111 next Segment Structure When the writing thread wakes up, it will notice the acks, slide the window and reuse the structure entries When an acknowledgement arrives, we mark the acknowledgement field in all packets with a lower sequence number. This allows us to recover from lost acknowledgements.
Threads • One thread for each segment (use usleep since it is threadsafe • One thread that looks through a table of semaphores with time stamps • This will cause you fewer headaches.
One Thread wakes up every second Time=23457, resend 90 and 100
Passoff Level Behavior Points Minimal Passoff 1 TCP segment can be sent reliably 8 Points Send window Send of multiple segments before acknowledge works 3 Points Receive one segment You are able to receive a short packet from the server correctly 2 Points Perfect behavior Passes all tests and correctly acknowledges all long packets 2 Points Passoff