This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CS168 Programming Assignment 3: TCP over IP over UDP Assignment Out: March 14, 2010 Milestone: March 27, 2010 Assignment Due: April 17, 2010, 10pm 1 Introduction In this project, you will implement a simple, but RFC-compliant form of TCP on top of IP from your last assignment. You will build the transport layer and export a sockets API similar to what you used in Snowcast. Chapter 6 of the book should be especially helpful. Each year, students report this assignment is an order of magnitude harder than its predecessor (seriously). But when you are done here, you will really understand TCP. Weve given you a lot of time for this assignmentuse it wisely! 2 The Pieces In this assignment you will use the library you wrote for IP as the underlying network (TCP uses a value of 6 for the protocol field of the IP header). Your TCP implementation will have four major pieces the state machine that implements connection setup and teardown, the sliding window protocol that determines what data you are allowed to send and receive at any point, the API to your sockets layer, and a driver program that will allow all of us to test your code. 2.1 State Machine You have to implement a state machine that allows state transitions in your TCP. You can use this diagram 1 to help orient yourself. The state machine is not as complicated as it may seem, but you should be sure that your TCP follows all state transitions properly, and doesnt do anything otherwise. For example, you need to send SYNs for connect, and FINs to close. You will be expected to follow RFC793 2 precisely. You dont have to handle the parts of the RFC that refer to urgent data, precedence, and security. You can start coding by just using the diagram and getting connections to set up and close under ideal conditions. However, there are tons of less obvious cases that the diagram doesnt cover 1 http://ttcplinux.sourceforge.net/documents/one/tcpstate/tcpstate.html 2 http://www.faqs.org/rfcs/rfc793.html 1 CS168 TCP- for example, what happens when, after a call to connect , youve sent a SYN, but you receive a packet that has an incorrect ACK in it? Once your basic state diagram is working, we recommend that you look at the RFC for answers to questions such as these. In particular, pages 54 and on contain info on exactly what you should do in such scenarios. 2.2 Sliding Window Protocol You need to implement the sliding window protocol that is the heart of TCP. Make sure you understand the algorithm before you start coding. Also keep in mind how sliding windows will interact with the rest of TCP (e.g. shutdown for write, etc). Be sure that you can accept out-of-order packets. That is, a packets sequence number doesnt have to be exactly the sequence number of the start of the window. It can be fully contained within the window, somewhere in the middle. The easiest way to handle such packets is to place them on a queue of potentially valid packets, and then deal with them once the window has caught...
View Full Document
- Spring '10