CS779/879
Assignment #1
Due Midnight, Wednesday February 18, 2009
Write the following program
in C:
NAME
McastSendRecv - Multicast Sending & Receiving
SYNOPSIS
McastSendRecv
<multicast-address> <port-number>
DESCRIPTION
The program creates two sockets:
Ø Multicast socket: M
The socket joins the multicast
group G defined by the two arguments:
<multicast-address> <port-number>
Ø Unicast socket: U
The socket is used to
send messages to G.
U is used to send two types of messages:
Ø Heartbeat
Messages: sent periodically
(e.g., every 5 seconds) to G indicating it
is alive.
Ø Chat
Messages: typed be the user at the keyboard and sent to G.
M receives two types of messages:
Ø Heartbeat
Messages: is
used to update the members list L.
Each member in L has a unique identity I
given by the U socket’s unique pair:
<IP
address, Port number>
Ø Chat
Messages: is displayed to the TTY preceded by the sender’s identity I.
When the user types:
Ø CTRL-C the program displays the members list
L.
Ø CTRL-D the program Exits.
The
following figure is an illustration of the program description.

Implementation details:
The program
utilizes the multicast examples and uses the UNIX signals.
For
introduction to UNIX signal handling, see Signals
You may test the Example implementation
at:
http://www.cs.odu.edu/~cs779/spring09/assignments/a1/wahab/
Testing the example:
% McastSendRecv 224.0.0.0
10101