Denison CS181/DA210 Homework

Before you turn this problem in, make sure everything runs as expected. This is a combination of restarting the kernel and then running all cells (in the menubar, select Kernel$\rightarrow$Restart And Run All).

Make sure you fill in any place that says YOUR CODE HERE or "YOUR ANSWER HERE".


Networking Foundation Homework

The majority of the questions in this homework come from the "Reading" question sections of the textbook. All of the questions will be graded "manually" based on the quality of your answers. The last few exercises ask for you to use the command-line curl, which you will do in a separate Terminal and the copy/paste the command and results into a code block within the Markdown answer cell.

Q1 The reading says a laptop can have two endpoints in the network, if it has both a wireless card and a wired Ethernet interface. Does this mean such a laptop can act like a router and be an internal node in the Figure? Can a smartphone ever act like a router? Explain.

YOUR ANSWER HERE

Q2 The reading makes it clear that information flows through a network architecture via packets, with packet switching handled by the routers. Paying careful attention to the figure, please answer: if we want to download data from a web server or RDBMS server, is there a unique path for the packets to follow as they reach our laptop machine? If not, what does this mean in terms of the order in which packets reach us, and the consequences of any routers or wires failing en-route? Please discuss both real-world consequences and computer science consequences/remedies.

YOUR ANSWER HERE

Q3 Why is it important that IP addresses be unique?

YOUR ANSWER HERE

Q4 In a world where packets can arrive out of order, how would you structure packets (i.e., what data would you make them contain) to allow them to be stitched together again at their destination in the correct order once they all reach their target?

YOUR ANSWER HERE

Q5 In a world where packets can be corrupted due to the physical way they are transmitted, please describe how you would address this problem if you were designing the internet. For instance, could you make the packets contain information that would tell the target node if the packet was corrupted in transit? What if that information gets corrupted? Think through these issues and sketch a plan.

YOUR ANSWER HERE

Q6 The book describes how, for some protocols (and protocol versions), a client-server exchange is limited to exactly one exchange over a socket connection, and for other protocols, there could be multiple exchanges over the same connection. Give pros and cons of these two possibilities.

Hint: Multiple exchanges over the same connection are called persistent connections. A Google search for this term could help solidify your understanding.

YOUR ANSWER HERE

Q7 What are some pros and cons of the use of cookies to save state and relate multiple requests into a *session?

YOUR ANSWER HERE

curl exercises

The last set of questions ask you to use the command-line utility named curl to make HTTP requests from web servers over the network. This will involve using the right set of "options", which are arguments specified on the command line after the name of the utility. Refer to section 20.4 in your textbook, and there is a PDF listing some of the most common options in your class github repository.

You will solve these problems using a Terminal window and then copy and paste your curl command along with output into the solution cell here in this notebook to show that you solved the problem. These will be graded manually, so there are no asserts following.

Since your solution cells are Markdown, and we want to present something from a Terminal window, I ask that you format the Terminal window contents by putting it into a code block. In Markdown, such a block begins with three backticks (the backwards quote located in the top left of your keyboard), then is followed by the lines you are copying in, and then ends with three backticks.

Q8 Write and test a curl request that obtains, silently, /data/ind0.json from datasystems.denison.edu

YOUR ANSWER HERE

Q9 Write and test a curl request that obtains, silently, /data/ind0.json from datasystems.denison.edu and saves the output into a file named ind0.json. In the Terminal, after executing the command, type another command

head ind0.json

to demonstrate that you successfully created the file.

YOUR ANSWER HERE

Q10 Write and test a curl request that obtains, /data/ind0.json from datasystems.denison.edu and protocol https and saves the output into a file named ind0.json. Request verbose output. Repeat with protocol http and observe the differences. We include three markdown cells below, one for you to show your https result, one to show your http result, and one for your observations of the differences.

YOUR ANSWER HERE

YOUR ANSWER HERE

YOUR ANSWER HERE

Q11 Experiment with what happens when you request a non-existent resource, say /data/foobar.json. What would be the correct incantation to get the status code? How about to see all the headers, including the 401 Not Found status line? When you request a non-existent resource, what is the body of the response message?

YOUR ANSWER HERE