CS 39006: Assignment 3 Concurrent Server Implementation
Your task is to implement a server and two clients with two different service requests. The
server can receive two different service requests from the clients as follows.
1. Request for a bag of words, where the server will forward a set of words from a file
word.txt one after another over a stream socket. The file word.txt contains a set of
words, one each at every line. Once the server receives a request for the words, it reads
the words from the file and forwards them one after another, each as a null terminated
string. The end of service is marked with an empty string (a string only with a null
character). Once the client receives that empty string, it prints the number of words
received and exits.
2. Request for the IP address corresponding to a domain name, where the client requests
for the IP address of a domain, say www.iitkgp.ac.in, over a datagram socket. The
server looks up for the IP address by using the system call gethostbyname(). The
server returns this IP address to the client. The client prints the IP address and exits.
You have to implement two clients, one corresponding to each of the services as mentioned
above. Note that the client requesting bag of words works over a stream socket, whereas the
client requesting for the IP address works on a datagram socket.
The server can receive multiple service requests simultaneously from different clients, and it
needs to respond to each client with the corresponding response.
You should write three C programs – selectserver.c (contains the server program),
bowclient.c (for bag of words requests) and dnsclient.c (for IP address requests). Keep
these three files in a single compressed folder (zip or tar.gz) having the name _Assignment3.zip or _Assignment3.tar.gz. Upload this compressed
folder at Moodle course page by the deadline (24th Jan 2019 2:00 PM).