DOC PREVIEW
UCLA COMSCI 118 - CS118_Project1

This preview shows page 1 out of 2 pages.

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

Unformatted text preview:

UCLA CS118COM SCI 118 SPRING 2014Project 1: Concurrent Web Server using BSD SocketsDue on 11:59PM, May 4th, 2014 (Sunday of Week 5)1 GoalIn this project, we are going to develop a Web server in C/C++. Also, we will take the chance to learn a little bitmore about how Web browser and server work behind the scene.2 Lab Working EnvironmentYou need a plain-text editor to create the source code. You can use vi/pico/emacs in Unix/Linux systems. SinceC/C++ is a cross-platform language, you should be able to compile and run your code on any machine with C/C++compiler and BSD socket library installed.Students should use Linux OS to finish the project. A virtual machine image of Ubuntu OS for your workingenvironment is provided. (You can download it from http://metro.cs.ucla.edu/cs118/CS118.rar) The account infor-mation is cs118/cs118 and root/cs118. It is recommended that doing the projects or at least testing them in thisprovided environment, because:• C/C++ compiler (gcc, g++) and BSD socket library on those workstations have been verified.• Your submitted code will be tested and evaluated on them.You need to install VMware Player, which has free versions, to use it (http://www.vmware.com/products/player/ ).The PCs in SEASNet labs already have it installed.Windows workstations are NOT recommended. They have their own idiosyncracies which may be too much forthis simple project. Also, TAs will not be able to help you on any of these platforms.3 Instructions1. Read Chapter 2 of the textbook carefully. The textbook will help you to understand how HTTP works.However, there are some differences:• You must program in C/C++ (not Java). Examples of socket programming Client/Server code in C areavailable on the course Website. They are also put in the folder /home/cs118/workspace in the providedUbuntu virtual machine image.• Instead of using port 80 or 8080 or 6789 for the listening socket, you should pick your own to avoidconflicts. It is suggested not to use port numbers 0-1024.2. The project consists of Part A and Part B, which are specified as following:• Part A: Implement a “Web Server” that dumps request messages to the console. This is a good chance toobserve how HTTP works. So start a browser, e.g. Microsoft Internet Explore (browser is the client side),connect to your server, record the request message, and find out what the fields in the message mean bylooking up in the textbook or RFC 1945.1UCLA CS118• Part B: Based on the code you have done in Part A, add one more function to the “Web server”, thatis, the “Web server” parses the HTTP request from the browser, creates an HTTP response messageconsisting of the requested file preceded by header lines, then sends the response directly to the client.3. Pay attention to the following issues when you are implementing the project:• If you are running the browser and server on the same machine, you may use localhost or 127.0.0.1 as thename of the machine.• Make sure your “Content-Type” function recognizes at least html files. We will worry about other typesof files later.4. After you’re done with every part (Part A and Part B), you need to test your server. You first put a htmlfile in the directory of your server, or more exactly, where you run your server. Connect to your server froma browser with the URL of http://<machine name>:<port number>/<html file name> and see if it works.For your server in Part A, you should be able to see the HTTP request format in the console of your servermachine. For your server in Part B, your browser should be able to show the content of the requested html file.5. Back to the “Content-Type” function. Add in the support for GIF and JPEG images. Your browser should beable to correctly show these MIME files.4 Materials to turn in1. Your source code files (e.g. webserver.c)2. A report of your project (pdf or word format) should not exceed 6 pages (except from source codes). In thereport:• Give a high-level description of your server’s design• What difficulties did you face and how did you solve them?• Include a brief manual in the report to explain how to compile and run your source code (if TAs can’tcompile and run your source code by reading your manual, the project is considered not to be finished).• Include and briefly explain some sample outputs of your client-server (e.g. in Part A you should be ableto see an HTTP request)You do not have to write a lot of details about the code, but just adequately comment your source code.3. The cover page of the report should include the name of the course and project, your partner’s name, studentid, and SEASnet login name. In each group there can be at most 2 students.4. Method of submission is described in Section 5.5 Project Submission1. Put all your files into a directory, named “project1 UID” where UID is the UCLA ID of one of the students inyour team.2. The directory “project1 UID” should include the following files:• Your Web Server code (e.g. webserver.c). The code of the server can be more than one files.• Your report (report.doc, report.pdf).• A Makefile. The TAs will only type “make” to compile your code, make sure your Makefile works underSEAS.• A README file which will contain Student names and Student IDs.3. Each group just needs to submit one set of files.4. Compress the folder into ”project1 UID.tar” file and submit it through


View Full Document

UCLA COMSCI 118 - CS118_Project1

Download CS118_Project1
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 CS118_Project1 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 CS118_Project1 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?