CS350 – OS – HOMEWORK 3 – Call Center solution

$24.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (4 votes)

Task1: Echo Server (5 points)
 You will write a TCP/IP-socket based client-server program with C language.
 The server (echo_server.c) will bind() to an IP-address and a port number (localhost / 127.0.0.1 and port
8888) to listen() to client connection requests on this line and accept() connections.
 The client program (echo_client.c) will connect() to the echo_server (localhost:8888) to send() and recv()
messages.
 The server will recv() text messages from the socket and send /echo/ write() them back to the client without
any change.
HINT: Analyze these links.
Echo Server: https://www.binarytides.com/server-client-example-c-sockets-linux/
Chat Server: https://stackoverflow.com/questions/19349084/chatroom-in-c-socket-programming-in-linux
Task2: Call Center (15 points)
 Based on the echo client/server code above, you will simulate a Call Center, where up to 2
clients/customers can be simultaneously accepted by the Call Center for echo or chatting (NOT
real voice). You need to use pthreads for this.
 Each client has 10 seconds to Chat/Echo with the server, after which the server will close the client
connection to accept new clients. You need to use a timer (gettime()? jiffy?) for 10 seconds.
 A 3rd client is also accepted (3rd thread), but not allowed to echo/chat until one of the two (2)
clients finishes. This represents a call center wait queue without an actual queue data structure.
 If a 4th client arrives, when the server is busy serving 3 clients it is NOT accepted.
 As a bonus (optional), you can write a shell script to start clients periodically, to test the server.
SUBMISSION GUIDE:
TAR/ZIP all *.c *.h files, and Makefile into hw3_First_Lastname.gz
Make sure it compiles and runs when we gunzip/untar and type “make”.
echo_client.c echo_server.c
Hello
Hello