Assignment #4

Due Monday November 10, 1997


Use Motif interface/TCP sockets to implement the following program:

NAME

Survey : A simple survey tool

SYNOPSIS

survey [time] [host port]

DESCRIPTION

The teacher invokes the program with one argument [time] to control how long (the number of minutes) the survey should last. In such case the program behaves as a server and displays the following message to the teacher's standard output:

let each student type: survey host port

where host is the IP address of the machine and port is the server port number.

In addition the program displays a motif interface similar to the teacher's interface of assignment #3 with the following modifications. Replace the count-down counter with count-up counter, indicating the number of students who have been connected to the server. In addition, a time-left counter should be added to the interface indicating the number of minutes remaining until no further votes are accepted. Note that the count-down does not start until the professor sends the survey question. The survey results are displayed to the professor interface as they arrive (like assignment #3). However, only the final result of the survey is sent to all currently connected students at the end of the survey (when the time-left reaches 0). This, unlike assignment #3, the students are not aware of the partial results of the survey, they can only see the final result.

When a student types:

survey host port

the program behaves as a client and establishes a TCP connection with the server (the teacher process). Upon the successful establishment of the TCP connection, the server sends to the client the number of minutes left until the end of survey. The student interface is similar to the student's interface of assignment #3, with only one modification: to add the time-left counter. When the time-left counter reaches 0, the student is not allowed to vote and the result of the survey is displayed (the result includes: the total number of students who have been connected to the teacher during the survey time, the number of YES votes and the number of NO votes).

In this assignment, assume that the professor can not quit (i.e., disable the Quit button) until the end of the survey. However, the students may quit at any time during they wish.


Back to Assignments Page
Back to CS476/576 Home Page