Write the programs using C++

Write the following programs using C++

NAME

MServer - Multicast-Chat Server. MClient- Multicast-Chat Client.

SYNOPSIS

MServer

MClient

DESCRIPTION

MServer:

  • Creates a TCP server socket Sand binds it to sport =10992,
  • Creates a UDP socket Uand binds it to sport.
  • Generates a random multicast IP address I & port P in the range (10000 to 11000).
  • Accepts connections on S from MClients.For each client connection it:

Displays its <hostname, Port> & sends it I and P

Sends <hostname, Port> out of U to the multicast group (I,P). Close the connection.

MClient:

  • Creates a TCP socket S and connects it to the MServer and reads the values of I and P.

The client contacts to any server running at one of the something hosts and listening at sport. Let Ps be the port number of S.

  • Creates a UDP socket Ur to receive the chat messages sent to the mcast group (I,P).
  • Creates a UDP socket Us and binds it to Ps to send chat messages to the mcast group (I,P).
  • Reads any message typed by the user and sends it to the mcast group (I,P) out of Us.
  • Receive any message from Ur and display it proceeded by the sender’s <hostname, Port>.
  • Exits when the user types CTRL-D.