GSP 215 Week 7 iLab Networking and a Tiny Web Server recent
TCO 1—Given a computing environment with multiple operating systems, demonstrate the ability to use the command line interface in Windows and Linux, and compile and run a program using the command line.
TCO 10—Given the importance of networking in game design, explain how computers are connected to a network, and summarize basic networking fundamentals, terminologies, protocols, and devices.
In this week’s lab, we will create two C programs to use with networking commands. The first program will read a domain name or dotted-decimal address from the command line and display the corresponding host entry. The second program will be a tiny web server used on localhost.
In this lab, we will explore DNS mapping by creating a file named hostinfo.c. This program will read a domain name or dotted-decimal address from the command line and display the corresponding host entry. Local host will always map to 127.0.0.2.
Enter the following C code into notepad. Save the file in the cygwin\home\username folder on your computer (ie: C:\cygwin64\home\gina) as hostinfo.c.
Open Cygwin, and compile the program: gcchostinfo.c –o hostinfo.
Run the program with the following domain names, and note the results. Also, choose some of your own.
Read pages 919-927 in the book. We will be developing the tiny web server listed in the book. This web server supports the GET method. It will look for an HTML file in the current directory and will display the web page in a web browser. Please study and review the code to understand what it is doing. Feel free to extend the code as well.
Copy the C code below into notepad. Save the file in the cygwin\home\username folder on your computer (i.e., C:\cygwin64\home\gina) as tiny.c.
Compile the program: gcctiny.c –o tiny.
, at a cygwin prompt, type ./tiny 10000.
This will start the web server listening at port 10000.
Open your web browser, and type the following in the address bar: http://localhost:10000/home.html.
This will open your website using your own tiny web server. To stop your tiny web server, press control + c in cygwin.
Include a screenshot below of your web page working in a browser.
//Tiny web server code