Write
the following program in C/C++ or any other language:
NAME
DAGMC - Destination Address Group Multicast Chat
SYNOPSIS
DAGMC <multicast-address> <port-number>
DESCRIPTION
·
The program creates a single UDP socket U:
The socket joins the multicast groups G1 & G2 derived by the two arguments:
<multicast-address> <port-number>
e.g., 224.0.0.1 10123
G1 (224.0.0.1, 10123) &
G2 (224.0.0.2, 10123)
·
The socket U is used to send/receive two types of
multicast messages:
1.
Heartbeat
Messages: sent periodically (e.g., every 5 seconds) to G2, indicating it is alive.
2.
Chat Messages: typed be the user at the keyboard and sent to G1.
·
When the socket
receives these two types of messages it reacts as follows:
1.
Heartbeat
Messages: are used to update a group
membership list L.
Each
member in L has a unique identity I given by the
unique pair:
<Host
Name> <Sender Process ID>
e.g., vega.cs.odu.edu 7893
Whenever
a new member is added/deleted, the program
displays the information I
of the added/deleted member and then
displays the updated list L.
2.
Chat Messages: are displayed to the TTY preceded by the sender’s identity I.
·
When the user types:
§ CTRL-C the program displays the list L.
§ CTRL-D the program Exits.
·
If it receives
a unicast message it replies to the sender by sending the list L.
·
The following figure is an illustration of the
program description:

·
You may test the Example implementation at:
http://www.cs.odu.edu/~cs779/spring11/assignments/a2/wahab/
Enter the following
command on some of the fast machines,
e.g., vega, antares, capella and procyon.
% DAGMC
224.0.0.1 10123