CS244a Programming Assignment Rules and Guidelines

This page will give you information about what we expect from you for the CS244a programming projects. Please read it carefully before starting the first project.

Background

Although the topic of CS244a is networking, the programming projects assume a good deal of background with Unix. You will need solid experience with the C programming language and at least a working knowledge of Unix file I/O, process management, and signals in order to do the programming assigments. If you are not sure you have the necessary skills, please talk to one of the course staff in the first week of classes to find out if you should defer taking CS244a until later in your curriculum.

Implementation Rules

All projects are to be done individually only.

All projects are to be coded in ANSI C. If you are unsure of the differences between ANSI and K&R C, there are a number of books available at the bookstore on ANSI C.

The only exception to this rule is Programming Assignment 1 (Web Proxy). This assignment (and only this one!) can be completed using C++. However, remember that you will be required to work in C for the rest of the quarter.

We expect good coding style throughout. At a minimum, good coding requires useful comments and meaningful variable names. We also expect you to design your program carefully, to achieve good functional decomposition, to use appropriate algorithms and library routines. Thirty percent of your total assignment grade is devoted to these style/design issues.

All of the assignments are designed to be implemented on the x86 Linux machines provided by Stanford- specifically, the myth cluster located in Gates B08. You can log into these machines remotely using SSH. If you develop your assignments on another machine, make sure that your code compiles and runs correctly on these machines.

At times there will be ambiguities in the assignment specifications, or multiple ways an assignment can be implemented. As CS244a is an engineering class, we expect you to make reasonable design decisions in these cases. Base your decisions on what you know of the assignment as a whole. The TA's may give you advice on the tradeoffs of these decisions, but will not make them for you.

Tools

There are several tools on the Leland systems that can make your life considerably easier.

make is a utility used to conditionally recompile your program based on the timestamps of the source code, object files, and executable. We expect that everyone in the class will have seen a makefile before as they are a permanent fixture of every flavor of Unix and most other platforms. If you don't know how to use make or write a makefile, learn. We require a makefile to be submitted with each assignment.

gdb is the GNU debugger. gdb is an interactive, source-level debugger. It allows you to trace through your code as it executes and examine program state. If your program seg faults, it will show you where. Learning to use gdb effectively will save you many hours of debugging hell.

To compile with gdb, simply add the '-g' flag to the gcc command. You can then start gdb with your program with the command

gdb progname
Type 'help' from the gdb prompt for more information.

Valgrind is a programming tool for finding memory leaks and memory errors. Use Valgrind to ensure that your program is not leaking memory, and that there aren't potential segfaults lurking in your code. The basic procedure for running valgrind is to run the command valgrind progname progarg1 progarg2..., where progname is the name of the program and progarg1, etc. are arguments to the program. Run valgrind --help for additional options- most of the things that you will be interested in will be in the Memcheck module.

Deliverables

There are two expected deliverables with each assignment. The first is the source code of your implementation. This should include a makefile which builds a program of the name specified in the assignment in the current directory. It is important to adhere to this requirement as some of the assignments are tested by shell scripts and must be graded by hand if your makefile is wrong. If you do not know how to write a makefile, look in the class directory for a sample.

The second deliverable is a project writeup. This file should be a file called README (all caps) and should be a text file. This file should contain the following:

Submission

Submissions are performed electronically, using the submit page on the course website. You will need to log in using your SUID before submitting your assignment. You should submit a tarball containing your assignment source code and any other files that you are required to provide by the specific assignment. We weill post a sample Makefile on the website that will show you how to easily create a tarball if you are unfamiliar with the Unix tar command.

Once you have created the tarball, go to the submission page and click the 'Browse' button to locate the tarball you are submitting. Select the appropriate file and click 'Okay'. The click the Submit button, and your tarball will be timestamped and uploaded to the teaching staff.

References and Resources

Unix Network Programming by Stevens is the reference of choice for programming the Unix sockets API. There will also be a review session before the first assignment is due which will provide an introduction to socket programming.

TCP/IP Volume 1: The Protocols, also by Stevens, is an excellent reference to the specification and common implementations of TCP/IP and some of the related protocols. Although this book is not a required course text, it is an excellent reference. Some of the assignments refer to chapters in this book for additional reading.

The RFC's (Request for Comments) are a set of documents which are the absolute reference for Internet standards. The RFC's are numbered sequentially. There is an RFC web page; you can also get the RFC's via anonymous FTP. Look at INDEX.rfc for a list of RFC titles.

Each student will be assigned a TA after signing up through the class web page. If you have a question that cannot be answered by any of the class materials or the above references, you should contact your TA. The TA's will hold office hours in the Sweet Hall; if you are having problems, you may want to schedule one of your programming sessions during these hours.


Last modified: Mon Jan 8 2007