Due: Wednesday, November 15, 2017, 2:10 pm (start of the class)


  1. (20 points) Textbook: Chapter 3 Review Questions R3, R4, R5, R6, R7, and R8.
  2. (40 points) Consider the trace from the previous assignment (https://www.cloudshark.org/captures/4edd9e0bf00f) and focus on the TCP layer:
    1. Show the absolute starting sequence numbers in each direction. It is fine to give a hex value.
    2. For the first 12 packets, give their main purpose (e.g., SYN-ACK, DATA, ACK, etc.) and sequence and acknowledgment numbers (it is OK to give values relative to the start of the connection).
    3. For every ACK packet in the entire trace indicate which packet it acknowledges.
    4. Can you see the connection being closed in the trace?
    5. On both client and server sides, indicate the TCP states (label the time axis of the time-space diagram with the state names).
    6. What was the total number of bytes sent from client to server?
    7. What was the total number of bytes sent from server to client?
    8. How long did the SMTP transaction take, including the TCP connection open?
    9. Identify few pairs of packets that could be used to estimate the round-trip time (RTT) both by the client and the server. List the observed RTTs and try to estimate the network latency.

Programming Assignment:

  1. (40 points) In this question you are asked to implement a web-based prefix calculator.
  2. Since this is not an exercise in web page development, the HTML for the solution is provided and should not be modified. A static (the AJAX request in the page results in a fixed response regardless of its parameters) example of the page can be found here. The page served in the trace can be downloaded from a4/formnjs.html. Using curl or wget is the easiest way to get the file to your account on agate.

    Write a node.js server that: serves the provided page formnjs.html, responds to the AJAX GET /prefcalc request from the page by returning JSON-encoded results of the prefix calculation, and returns HTTP 404 Page Not Found status code for any other request.

    A sample run of your code may look as follows: my server was started on my machine on port 8000 so in a browser window I typed localhost:8000/formnjs.html (if your server runs on a remote host such as agate, you obviously need to enter a hostname or IP address of that machine). My server served the page and it was displayed in the browser window.

    Page before click

    After clicking on the Submit button, the page contacts the server again with a GET request for /prefcalc with URL-encoded values from the form. The server returns the result in JSON format. The received values are displayed in the page.

    Page after click

    To see what is going on under the hood, take a look at the network trace of this session: https://www.cloudshark.org/captures/30efb055cef5. In CloudShark, select Analysis Tools and then Follow Stream, to see the data exchanged during the session. Pay attention to the details of the two requests being sent, especially the URL-encoded form data, and the server responses (Content-Type: application/json in the header and the JSON-formatted data being sent back). Your server must be able to handle such requests and must send responses in the way.

    As with any servers, it is very likely that your implementation contains significant security holes that can be easily exploited. For that reason, do not leave your code running longer than it is necessary for testing. This is also the reason why the example page uses no active components on the server side.

Submission instructions:

Upload your submission as a single PDF file using Canvas (mycourses.unh.edu). More details can be found in the standard assignment submission instructions.

© 2017 Radim Bartos.