Professional Documents
Culture Documents
Fall 2007-2008
Computer Engineering Department
Near East University
Homework 6
Week of December 31, 2007
due in class, on Friday, January 11, 2007
Consider the source code for client and server given in Chapter 10 of your textbook. Complete the
implementation of both the client and server source code according to the following specifications:
where <name> is an arbitrary name for identifying each client, <message> is a text message to be sent to
the server, <ip> is the server IP, and <port> is the port to which to connect on the server.
After connecting to the server, the client should send the <name> and the <message> to the server. Then
the client should wait for a message from the server. It should receive that message, print it out, and
finally exit after a brief wait, in order to allow the server to receive the two pieces of information sent.
./server <port>
where <port> is the port on which the server should run. This is the same port to which clients will later
connect.
For each client, the server, in a child process, must first receive the name of that client and the message
sent by that client. In reply, the server must read the current date and time, send this information back
to the client and close its connection with that client.
The date and time should be printed in the following format:
An example C program will be provided (See course website) that demonstrates how local time and date
may be printed out in the above format. An example output of the example program is:
3. Below is an example interaction between a client and the server. Suppose the following two commands
are used to start the server and run the client:
./server 7000
Submission Requirements
• Your typed program.
• Use the script command to record your run sessions. Provide this output as validation of the correctness
of your programs. Please edit the typescript file produced by script to remove uncessary content.
• Please use the provided standard cover page when submitting your work.