7.9.0.10

E — TCP

Due Thursday, September 24, 11:59:59pm

Purpose to explore the TCP libraries of the chosen programming language; to deliver software as specified; reflect on the language of your choice.

Delivery You must deliver xtcp, Test/, and experience.pdf and assessment.pdf in a directory called E in your repository. The three artifacts are specified in the Task, Test, and Memo sections below.

All auxiliary files must be put into a sub-directory called Other.

Task Develop xtcp, a program that consumes a sequence of well-formed JSON values from the input side of a TCP connection and delivers JSON to the output side of a TCP connection after the input side is closed.

The program’s takes at most one command-line argument. This argument specifies the port to which the program connects (on the default network card). If there is no command-line argument, the program uses the default port 4567. Also, the program waits for at most 3 seconds for a client to connect; if no client connects, the program terminates with an error.

The program’s functionality is the same as xjson from C — JSON. You are welcome to reuse your solution. (The ideal reuse is a call to the solution of C — JSON; copying the code is acceptable for this exploratory programming task.)

Hint The netcat program (abbreviated nc) is the best way to manually send JSON information from your shell to your server:

    [login-students] $ cat 1-in.json | nc login-students.ccs.neu.edu 45678

This command connects the cat command with the nc command via a pipe. Specifically it sends the content of the 1-in.json file to nc, which in turn transmits it via TCP to the computer with the IP address login-faculty.ccs.neu.edu at port 45678 (if all of you use 8004567 on the same computer, bad things will happen).

Hint The netcat program is likely not pre-installed on modern Windows systems. Windows users should may wish to visit download and install the nmap site, download the ncat executable, and add it to their path.

The following screen shot shows how you can launch xtcp on one machine (here antarctica):

On a separate machine, you can then run the netcat command to connect to the first machine:

Here the second nc command sends JSON from login-students to antarctica, also on the ccs.neu.edu network. Note how the two command lines specify the same port. Switching between these two terminal windows takes time, and the first nc command shows what happens when you’re too slow or you haven’t launched xtcp yet. Finally note that as soon as the server has done its work for its sole client, it shuts down, after sending back an answer to the client. The nc command displays the answer in the shell.

As mentioned in class, the phrase "integration test" is used here because you are welcome to integrate the solution for C — JSON with some additional code to solve this problem.

Test Create three integration tests for xtcp in the directory Test/.

A test always consists of inputs and expected outputs. For this course, a test consists of two files: n-in.json, the input file, and n-out.json, the expected output file, where n is any positive integer between 1 and the demanded number of tests.

Summary Memo Write two half–page memos: experience.pdf and assessment.pdf.

The first reports your experiences with your exploratory programming tasks. The second one states your evaluation of the language based on this experience.

Imagine you are writing to your manager’s manager.

You must use an 11-point font (or larger). The white-space margins on your page must be at least 1 inch wide on all sides.

If your assessment leads you to the conclusion that you wish to switch to a different language, complete the assignment as specified and contact your instructor to make a 1-1 appointment immediately.