V22.0480-002 Special Topics: Networks


Homework 2: Create a networking application using the socket interface to implement a "character count" service over TCP.

For this assignment, you must write the client and server code to implement a character count service over TCP. The following describes the application, session, and presentation layers.

Application Layer:

The client side of the application connects to the server. The client then reads characters from the terminal until it reads a new-line character. The client sends all characters entered to the server (including the new-line character).

The server reads the characters, counts the characters, and returns the count back to the client. The process repeats until the client sends "bye" (followed by a new-line).

Session Layer:

The new-line character serves as the session-layer ending of each string. When the client wants to end all communication, it sends the word bye followed by a new-line character.

Presentation Layer:

The client sends ASCII characters to the server. The server returns a NULL-terminated ASCII string containing count. So, if the client sends 102 characters, the server would return the NULL-terminated ASCII string "102".

Here is an example output:

$ rcount courses4
How long is this string?????

The address of your service will have a port number that corresponds to the last 5 digits of your student ID.

What you must turn in:

Due date: Monday, February 28