• 沒有找到結果。

Writing a Report on a Web Server Program

N/A
N/A
Protected

Academic year: 2022

Share "Writing a Report on a Web Server Program"

Copied!
7
0
0

加載中.... (立即查看全文)

全文

(1)

Homework #2

Writing a Report on a Web Server Program

National Chiao Tung University

Chun-Jen Tsai

03/30/2012

(2)

Homework Highlights



For this homework, you have to do two things:

 Study the source code of a mini web server program

1) Trace the structure of the program

2) Learn network programming using socket API by yourself

3) Understand the behavior of a server

 Write a report and email it to the TA, by the end of 4/16.

TA’s email address: [email protected]. The report must be in the pdf file format.



Additionally, you can try to improve the program:

 Adding more information to the server log

 Improving the error handling mechanism of the server

 Fix any bugs you find

(3)

Target Program: nweb.c



A mini web server program, nweb.c, can be downloaded from the class website

 The program is a simple command line program (no GUI)

 You can compile the program using Visual Studio 2008 or gcc for Win32 (e.g. MinGW)



The server, “nweb.exe”, is a command line program

 The server listens to TCP port 80 for the HTTP traffics

 All the web pages should be stored in “c:\public_html”

 You can use any web browser (e.g. IE) to connect to the server and browse the web pages

 The server generates a log file, nweb.syslog, that records http requests from all clients

(4)

Study nweb.c and Write a Report



Your report

should contain at least four sections:

 Introduction

 Give a general introduction to how the client/server model of web server & web browser works; or the concept of socket programming

 Program analysis

 Describe your understanding of the program. You can use block diagrams to explain the algorithm of the program

 If you find any bugs in the program, you can also make some comments in this section

 Improvements

 You can discuss on how to add functions to this web server

 Discussions and Conclusions

 Summarize what you have learned from this homework

(5)

Comments on Network Programming



Network programming is usually based on the BSD socket library.

 Hence, some people refer to network programming as

“socket programming”



Microsoft Windows has its own version of socket library, called Winsock library

 Winsock is very similar to the BSD socket, but not 100%

compatible

(6)

Web Resources for Socket Programming



Winsock programming guides

 http://www.madwizard.org/programming/tutorials/netcpp/1



General BSD socket programming guides

 http://www.beej.us/guide/bgnet/output/html/multipage/index.html

(7)

Comments on MinGW Compilation



If you are interested in using MinGW to compile nweb.c , you can download the GNU toolchain for Windows from http://www.mingw.org/



After installation, just type the following command from command prompt:

c:\nweb> gcc -o nweb nweb.c -lws2_32

The executable nweb.exe will be in current directory.

參考文獻

相關文件