CS779/879

Assignment #4

Due Midnight, Wednesday April 22, 2009


Write the following two programs.

NAME

UCServer   Universal  Chat Server

UCClient  -  Universal  Chat Client

SYNOPSIS

UCServer     <multicast IP address>      <port> 

UCClient      <Type>    <multicast | unicast IP address>      <port> 

 

DESCRIPTION

 

UCServer:

 

The server creates   three  sockets:

 

·       TCP socket T, 

·       UDP socket U and

·       SCTP socket S.

 

All three sockets are binded to <port> and the udp socket  U joins the <multicast IP address>.

 

The server performs the following actions:

 

·       Any multicast message received on U is sent to all non-multicast clients.

·       Any non-multicast message received on U, T or S is sent to all unicast and multicast clients.

·       The server saves the known chat senders/receivers information into a Client List CL.

o  The CL contains a record R of each known client who has sent and/or received a chat message.

o  R contains: the client IP address, port number and its Type (either: SCTP, UDP, TCP or Multicast).

·       The server responds to any connection/message from 127.0.0.1 by sending the content of the CL to the sender.

   

UCClient:

 

The client creates one socket C, the type of C is determined by the command first argument  <Q|S|U|T|M> :

 

§  Q  -  sctp SEQPACKET socket.

§    -  sctp STREAM socket.

§  U  -  udp socket.

§  T  -   tcp socket.

§  M -  udp multicast socket. 

 

The client concurrently monitors C and  the stdin for received data.

Data received from stdin is sent to C and data received from C is sent to stdout.

 

·       If the type of C is M, the data is sent as a multicast message to <Multicast IP address> and <port>.

·       If the type of C is either S  or T, the client connects to <Unicast IP address> and <port>.

·       If the type of C is either Q or U, the data is sent as a unicast message  to <Unicast IP address> and <port>.

 

 

Examples:

       

% UCServer            224.0.0.10            10111  

 

% UCClient   M     224.0.0.10             10111

 

% UCClient   U     128.82.4.120         10111 

% UCClient   T     128.82.4.120         10111

% UCClient   Q     128.82.4.120        10111

% UCClient   S     128.82.4.120         10111

 

% UCClient   U         127.0.0.1            10111

% UCClient   T         127.0.0.1            10111

% UCClient   Q         127.0.0.1            10111

% UCClient   S         127.0.0.1            10111