Subsections

Code

TCP utilities

You can find here various helper functions for both servers and clients (take a look at the header for details). You are welcome to use it in your assignments, but first make sure you understand what happens in there. In other words, keep it someplace and refer to it once you are presented with new TCP-related concepts; the archive may contain examples of use for these concepts. You are not expected to understand all the code at once, concepts shall be introduced as the course progresses.

TCP clients

Here is a simple client. The archive contains the various functions for TCP clients you have seen already (tcp-utils.h and tcp-utils.cc), and code for a simple client that does roughly the same thing as the parameterized telnet client (client.cc).

TCP servers

You have seen a client, so we now have a server for a change. Besides the known tcp-utils module (tcp-utils.h and tcp-utils.cc), the archive contains a simple server, which receives lines of text from clients and send them back prefixed by a string. There are in fact three implementations of this server, produced by the following targets in the associated makefile (the default target makes them all):

Multithreaded servers

Our server collection got two more servers: a multithreaded one (tserv.cc) and another which features a monitor thread (mtserv.cc). The implementation of the monitor is for all practical purposes identical to the one presented in Section 12.8 of the textbook.

Incidentally this archive also contains a makefile that through judicious macro definitions does not need any rule actions (except of course for the “clean” target).

Concurrency management

Here you have yet another addition to our family of servers. Specifically, you have now a multithreaded server with a control socket opened to local machine only (mctserv which is also a multiservice server if you think about it), a multithreaded server that uses preallocation (mtpserv), and a multiprocess server that also uses preallocation (cpserv).


Servers, servers everywhere

Here you have the whole collection of servers. In addition to what you have seen already, a sample super server has been added (see the included README for details).