CS111 - Project 1B: I/O and IPC

INTRODUCTION:

In this project, you will build a multi-process telnet-like client and server. This project is a continuation of Project 1A. It can be broken up into two major steps:

RELATION TO READING AND LECTURES:

This lab will build on the process and exception discussions in lecture 3, but it is really about researching and exploiting APIs.

PROJECT OBJECTIVES:

DELIVERABLES:

A single tarball (.tar.gz) containing:

PROJECT DESCRIPTION:

Study the following man pages.

Passing input and output over a TCP socket. 

Using Project 1A’s step 2 (the --shell option) as a starting point, create a client program (client.c) and a server program (server.c), both of which support a --port=<portno> option. (Note there’s no need to maintain the --shell option.)

Your overall program design will look like the diagram above. You will have a client process, a server process, and a shell process. The first two are connected via TCP connection, and the last two are connected via pipes.

To send commands to the shell, you will need to run both the client and the server. On the client side, the behavior will be very similar to that of Project 1A, in that you will see your commands echoed back to the terminal as well as the output from the shell. Do not display anything on the server side.

 

This tutorial is a very detailed introduction to socket programming; it goes line-by-line through basic client and server code.

If you plan on developing on lnxsrv, please e-mail your TA to get a port number to avoid collisions. Otherwise, use a port number larger than 1023 (ports numbered lower than 1024 are reserved).

The --log=<filename> option.

On the client side, implement an option, --log=<filename>, which copies all data sent to and read from the client’s socket and writes it to the specified file. Prefix all entries with “SENT X bytes” and “RECEIVED X bytes: ” as appropriate. ETA: remember to include the “: ” (colon-space)!

Sample log format output:

SENT 35 bytes: sendingsendingsendingsendingsending

RECEIVED 18 bytes: receivingreceiving

Encrypted communication.

SUBMISSION:

Project 1B is due on Monday, April 18.

Your tarball should have a name of the form lab1b-studentID.tar.gz and should be submitted via CCLE.

We will test it on a SEASnet GNU/Linux server running RHEL 7. You would be well advised to test your submission on that platform before submitting it.

RUBRIC:

Value        Feature

        Packaging and Build (15%)

5%        untars expected contents

5%        clean build w/default action (no warnings)

3%        Makefile has working clean and dist targets

2%        reasonableness of README contents

        

        Communication (45%)

2%        Both programs accept the --port option

2%        ETA: Both programs accept the --encrypt option

14%        client program passes data between terminal and socket, reads shell output from server

14%        server program starts shell and reads/writes from/to shell (executes commands)

3%        ^D at client closes network connection, restores terminal modes, and exits with RC = 0.

3%        EOF/error on either side of network closes connection, exits properly with RC = 1

2%        EOF or SIGPIPE at server from shell pipes exits with RC = 2.

5%        functioning --log=filename option

        Encryption (30%)

5%        Include key file & use key file for encryption-based communication

10%        Data is encrypted before sending

10%        Data is decrypted on receiving

5%        --log option records outgoing data post-encryption and incoming data pre-decryption

10%        Code review (10%) -- checks that you’re using the right libraries, etc.