In Lab Assignment 3
Implementation of a Concurrent Server Using fork()
In this assignment you will write a concurrent TCP server using fork().
The server code should be able to run for different number of clients. Each client
sends repeated messages to the server and the server replies with the same
message. Client messages should be user input in run time. When a client sends
an exit (“EXIT”) message to the server, the server releases the
connection.
Hints:
- First, try to understand how
fork() works. Here is an overview of why
child processes are necessary and how the main process (the parent)
handles them. Here is a sample program using fork().
- The codes of the book [TCP/IP
Sockets in C - Practical Guide for Programmers] are available through http://cs.ecs.baylor.edu/~donahoo/practical/CSockets/textcode.html.
You can download the [TCPEchoServer-Fork.c (without SIGCHLD) ] code and
use it as a template for the assignment.
Below are some links that might be useful for those
who would like to refresh their Operating Systems knowledge on the usage of
fork():