CSCI 7818: Meddling with Middleware
How I Learned to Love Programming on the Internet


General Instructions

Solutions to homework assignments should represent your own work. However, you are free to discuss the assignment with others, as well as to use outside sources such as books and papers. If the discussion and/or the outside references substantially influenced the solution, you should explicitly cite those sources (e.g., give the name of the classmate, title and page numbers of the book, etc.).

How to Submit your Solutions

You should send your homework solutions to Antonio Carzaniga by e-mail ( in the form of one MIME attachment. In case the solution includes more than one file (source, documentation, Makefile, README, etc.), you should attach a TAR (or ZIP) file containing everything. In case your mailer does not support MIME attachments, you should uuencode the TAR (or ZIP) file and append the resulting text to your message.

All the assignments are simple enough to fit a single (flat) directory, so your TAR (or ZIP) file should not contain directories. You should include a Makefile or a README file or both. If you use non-standard libraries make sure to include them in your package and indicate the appropriate environment settings (e.g., CLASSPATH or LD_LIBRARY_PATH) in your README or Makefile. Unless explicitly specified, everything should work in a clean environment.

Homework Assignments

Socket Programming: Chatroom

Due: 2:00pm Jan 26

Create a chatroom system composed of a server component and a client component. Each user participates in a chatroom conversation with other users by connecting his/her client component to the chatroom server. The communication between a client and the server is implemented through a TCP/IP socket.

The chatroom client works within a normal terminal shell. It reads user's input, line by line, and sends each line of text to the chatroom server. The client also reads lines from the server and prints them on the terminal. The client reads and prints messages from the server asynchronously, that is, independently of user's input.

The chatroom server accepts connections from clients. Multiple clients can be connected to the server at the same time. The server reads lines of text coming from each client's connection and forwards them to every other client. The server forwards client messages as they come in. This means that if a client, say client A, sends a message, the server should not block waiting for another client (B) to produce text before forwarding A's message.

Support Materials and Hints


Due: 2:00pm Feb 9

Create an application httpfetch that retrieves documents accessible through HTTP. httpfetch takes a list of URLs as parameters, possibly with some selection parameters and an HTTP proxy address. httpfetch downloads and saves into the current working directory every document that matches the selection criteria. The selection parameters specify a maximum length and/or a specific MIME type. If no selection parameters are specified, httpfetch downloads the documents associated with every URL passed to it. The syntax of command-line parameters is as follows (parameters in square brackets are optional):

    httpfetch [-proxy URL] [-maxlen num] [-type type] URL [URL ...]
-proxy URL
httpfetch uses URL as its HTTP proxy for every HTTP request.
-maxlen num
httpfetch downloads only those documents whose Content-Length is less than or equal to num.
-type type
httpfetch downloads only those documents with a Content-Type of type.

Any error reply must be reported to the user. It is not required that httpfetch be able to handle the full HTTP protocol. In particular, it is not necessary that httpfetch handle redirection replies (status 3xx). Replies that are not handled or unknown replies must be reported to the user just like error replies.

Support Materials and Hints


Due: 2:00pm Feb 16

Create a DTD specification for an XML database of musical compact discs. The database consists of album entries. Each album consists of one or more CDs. An album has attributes including author, performer, title, publisher, year, total playing time, etc. Each CD has a set of tracks, each one carrying information such as title, author, performer, playing time, etc. When a track doesn't specify an author or a performer, that track implicitly inherits their values from the album specification. Some tracks may be further divided into movements. The DTD must be sufficiently expressive to model the CDs of this informally structured list.

Rewrite the information contained in the list using the XML format that you defined (this can be done by hand) and create a program xmlcd to read and query such XML data. xmlcd. The syntax for xmlcd is:

   xmlcd [-author name] file
If you do not specify the -author option, xmlcd reads file and prints its content in some reasonable plain-text format (see list). If -author name is specified, then xmlcd prints only the tracks authored by name.
Support Materials and Hints


Due: 2:00pm Mar 1

Create a virtual auction system using Siena. The virtual auction works very much like a real auction in which sellers present items, with a description and possibly with a starting price, and buyers make their bids. There is no arbiter in this auction, therefore it is the responsibility of sellers to decide when to close the deal and start the monetary transaction with the buyer. Buyers can limit the validity of their bids by specifying a time-out.

The system consists of a seller program and a buyer program. Sellers use the seller program to:

Buyers use the buyer program to: Items must be presented by sellers with a concise structured description. The purpose of this structured description is to allow buyers to select the items they are interested in. For example, an announcement might look like this:
seller = "Joe"
item = "s21kj-77-1"
category = "music/instruments/guitars"
maker = "Paul Reed Smith"
model = "Custom"
color = "tan"
top = "maple"
body = "mahogany"
year = 1991
conditions = "excellent"
price = 3200
a buyer might then express interest in something like this:
category = "music/instruments/guitars"
maker = "Fender"
model = "Telecaster"
year < 1970
price < 1500
after receiving and evaluating some notifications, the buyer might make an offer like this:
buyer = "Foo"
seller = "Joe"
item = "314159265"
offer = 2150
expires = "Mar 1 2000"
at any time, the seller might decide to close the deal on an item with any one of the bidders. To do that, the seller contacts the buyer and sends out an announcement that that item is not available any longer:
seller = "Joe"
item = "314159265"
It is not required that every communication occur through Siena. For example, in closing the deal, buyers and sellers might exchange e-mail or simply use the telephone. For the purposes of this assignment, we will assume that when the seller closes the auction, the process is finished as far as Siena is concerned.
Optional functionalities
There are optional pieces of functionality that may be provided as part of your solution.
Support Materials and Hints

this page is maintained by Antonio Carzaniga, $Date: 2000/02/22 22:39:25 $