DOC PREVIEW
U of I CS 438 - Application-Level Framing over TCP

This preview shows page 1-2 out of 5 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

ECE/CS 438: Communication Networks Fall 2006Machine Problem 2 Due: 9:00 p.m. Wednesday, October 4Application-Level Framing over TCPPlease read all sections of this document before you begin coding.In this machine problem, you will develop software to transfer a file in a specific format across a TCP connectionto another terminal. The novel (and perhaps challenging) aspect of your client-server protocol will be the use ofapplication-level framing to encode the contents of the file on a line-by-line basis. A command-line argument to theserver specifies the file name, and the server must deliver this file to each client that contacts it, possibly sending con-currently to several clients. Each client receives the encoded data and interprets it appropriately to recreate an exactcopy of the original file, again using a file name specified on the command line.ObjectivesThe primary goals of this machine problem are for you to learn to build simple client-server applications using thesockets API and for you to understand the process of sending messages over TCP. Servers generally manage multipleconnections simultaneously, and you should also learn the basics of concurrency from this problem.As mentioned above, you will implement a client-server pair to encode the contents of a file for transmission over aTCP connection. The file is defined as a set of lines with a particular format (see the Specification section below). Youmust design a framing strategy that allows your client to recover the original data and to create an identical copy ofthe original file. For this design, you must consider both correctness and efficiency (the overhead of framing). Yourserver must handle multiple client connections concurrently, which can be done in several ways. For this assignment,you might prefer to use multiple Unix processes; in later assignments, you will need to use multiple threads.In addition to correctness, your design will be judged on its efficiency, i.e. how many bytes are needed to transmit thefile. Your submitted results must include three or more designs and analysis of their relative efficiencies for a samplefile. You need implement only one of the designs.To get you thinking about efficiency, examine the given file format closely. The format was not random, so lookingat the data the file represents may give you ideas about what can be done to send less physical data over the wire, butstill send logically the same thing.For example, to represent 8 symbols, how many bits are needed? If each symbol was sent as a char, how many bits arebeing sent?GuidelinesPlease work on this MP individually. Collaboration, discussion, code sharing, and any other form of group work isforbidden. Offenders will be dealt with appropriately (see the general information sheet available from the class homepage).You are required to make sure that your programs compile on the {dclsn,glsn}*.ews.uiuc.edu machinesand to use the EWS lab. Programs suffering compilation errors when tested by the course staff will earn no credit.You may find it useful to read Chapters 1-4, 6, and 8 in Stevens. Refer to the Unix man pages as necessary.Please indent and document your code. Use meaningful names for variables and follow other style guidelines thatenhance the clarity of your code.Follow the guidelines in the “Hand In” section below when turning in this assignment.SpecificationMake a directory called MP2 somewhere inside your main directory to hold your code. Call the file for your servercode server.c and call the executable server. Follow the same convention for the client. Note that the sourcefile names are recommendations; in contrast, the executable file names are requirements. Create a Makefile thatautomatically generates the executables from your sources.This problem consists logically of three components: a client thread, a main server thread, and a per-client serverthread. This document refers to the problem components as threads, and you are encouraged to use Posix threads toimplement them (see Chapter 23 of Stevens). In later machine problems, threads will become a requirement. However,for this problem, separate Unix processes (see Beej’s code from MP1) are also acceptable.File Format: The file format for use with this machine problem is an example of a directoly listing. A sample file(from ∼ece438/MP2/sample) appears below:rwxrwx--- 75 Feb 18 2005 foo/bar 7 1234 1453r--r--r-- 134 Jan 24 2006 foo/baz/quux 12 1234 1453r-x--x--x 12000 Oct 1 2006 fred 4 1453rwx------ 0 Sep 13 2006 barney 6 1234A file can contain any number of lines of the form shown. Each line consists of several fields, and must follow therules below:1. All fields must be separated by exactly two SPACE characters, and each line terminated by a single linefeed,with no additional white space.2. The total number of characters, including the linefeed at the end, can be no more than eighty.3. The first field is a set of flags in 3 groups of 3: rwxrwxrwx. Each flag is either present or marked absent with r‘-’.4. The second field is the file size (at most 232− 1)5. Fields three through five represent the date. The month is first, represented by the first three characters of thename, followed by the date, followed by the year. Assume the year is in the range 1970–2037.6. The six field is a file name. It may contain characters ‘a’–‘z’, ‘A’–‘Z’, ‘0’–‘9’, ‘/’, and ‘-’7. The seventh field is the length of the file name.8. The last fields are a list of user IDs allowed to access the file. This list contains numeric IDs in the range 0 to65535.Framing Styles: You must consider at least three frame formats to communicate the lines of the files from the serverto its clients. For example, you might simply send the full text of the file, although such an approach is not veryefficient. The required multiplicity is intended both to help you understand the possibilities and to introduce you to thecomplexity and utility of each approach. Consider applying the methods discussed in class to frame the variable-lengthlist of user IDs.Refragmentation and Logging: One very important aspect of TCP byte streams that many people find difficult tograsp is the fact that calls to read and write (or send/recv, etc.) are not correlated. In particular, two or more writesto a connection can be received by the same read, and a single write can be split amongst several reads. The EWSenvironment makes this lesson harder because, on a local


View Full Document

U of I CS 438 - Application-Level Framing over TCP

Documents in this Course
Routing

Routing

5 pages

TCP

TCP

26 pages

TROLL

TROLL

3 pages

Load more
Download Application-Level Framing over TCP
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Application-Level Framing over TCP and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Application-Level Framing over TCP 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?