CS 471 - Operating Systems

Due Midnight, Thursday Feb 23, 2011

 

Write the following two programs

 

1)   TCServer (ThreadedChatServer):

 

ü Accept TCP connections from any number of  TCClient (described next).

ü For each TCClient C it creates a separate thread to serve C and sends a list L of currently connected TCClients to C.

ü If it receives a message M starting with ? from C it sends L to C otherwise it sends M to all currently connected clients.

 

Usage Syntax:

               TCServer    <port>

Example:

           % TCServer   10123

 

2)   TCClient  (ThreadedChatClient):

 

ü The client connects to the ChatServerThread  at <port>

ü The client creates two threads:

§  One thread reads  messages from the stdin and sends it to the TCServer.

§  The other  thread reads the received messages from  the TCServer and displays it to the stdout.

 

Usage Syntax:

             TCClient   <server host>     <port>

Example:

         % TCClient     localhost          10123

You may execute my solutions at:

http://www.cs.odu.edu/~cs471w/spring12/assignments/a2/wahab