Today, you will work on Part 2 of Part 2 of Lab 2, but I also want you to demo your Part 1 solution to me and try out your Part 1 solution with other group’s Part 1 solution.

About Part 2 of Lab 2

You are implementing the same talk protocol, but the client and server’s behavior changes. This part requires implementing multi-threaded client and server program. I’ll demo my solution again.

Handy References for Part 2

Look at the Requirements and Tips and Resources section of Lab 2 assignment for some links, and tips for:

  • C programming, C strings, C string library, readline library, pass by pointer, …​ (also Chapter 2 of Dive into Systems)

  • gdb and valgrind guides (also Chapter 3 of Dive into Systems)

  • debugging tips for pthreads programming

  • socket programming

  • man and man pages

Set-up for Demo of your Part1 Solution

Start out today by compiling your Part 1 solution and copying the executables to different files (so that you can continue working on Part 2 while I’m looking at other groups' Part 1 solution):

make
cp cs87_client p1Client
cp cs87_server p1Server

If your repo has committed code beyond Part 1, you can either clone another copy of your repo somewhere else, and checkout out your tagged part1 version, compile and build it.

mkdir temp
cd temp
git clone [ssh for your Lab02 repo]
git tag -l
git checkout tags/your_part1_tagname
make

Or you can checkout your part1 version in your current repo, compile it, copy the executables to part1_client and part2_client, and then checkout master to get back up to date. If you do this, make sure that you have done a git add, git commit and git push of any modifications you have in your repo first.

git status    # list anything that is diff from master
# add, commit and push anything that is
git add client.c ...
git commit -m "part of part2"
git push

Then checkout your part 1 tagged version.

git tag -l    # list your repo tags
git checkout tags/your_part1_tagname
make clean
make
cp cs87_client p1Client
cp cs87_server p1Server

# then get back current version:
git checkout master
make clean