Develop a client and a server for an instant messaging system based on UDP and IPv4 with the following specifications: for linux
1. The service is available only to a predefined group of clients. The aim of the service is to let each client of the group broadcast messages to all the members of the group.
2. Message broadcasting is done through the service: a client sends the message to broadcast in a UDP datagram to the server, which forwards the same message to all the other members of the group, using UDP again.
3. The transfer of messages from client to server is protected by a simple positive acknowledgment and retransmission mechanism, while the transfer of messages from server to client is best-effort, with no ack and no retransmission mechanism.
4. The server reads the list of clients belonging to the group at startup from a local text file named users.txt (placed in the same directory where the server has been started). Each line of the file identifies one client and has the format where is the client’s dotted decimal IPv4 address and is the client’s port number written in decimal ( and are separated by a space)
5. A datagram from client to server includes the text of the message (a string of at most 1024 8-bit ASCII characters) preceded by a sequence number (a 2-byte binary integer in network byte order). Each client starts numbering messages from a random nonzero value and increments the sequence number each time a new message has to be sent.
6. A datagram from server to client can take one of two forms, distinguished by the value of the first byte:
a. if the first byte is 1, the datagram is an acknowledgment and includes, after the first byte, only the
sequence number of the acknowledged message.
b. if the first byte is 0, the datagram is used to forward a message. After the first byte, there is the IP
address and port number of the client from which the message was originated (with the same format
as in the users.txt file), followed by the message itself.
7. The server accepts UDP datagrams on a port whose decimal number is specified as the first command line argument of the server. Only datagrams arriving from the clients listed in the file users.txt are accepted.
8. For each client, the server keeps the sequence number of the last forwarded message (0 initially). The server acknowledges a received message in any case, but forwards it only if the message sequence number is different from the sequence number of the last forwarded message coming from the same client.
9. The client receives the following arguments on the command line (exactly in the order specified here): the port number of the client, the name of the server, and the port number of the server.
10. The client must display each received message coming from the server on the standard output, including the leading line that specifies IP and port number of the message originator.
11. The client must also read input lines from the standard input. Each read line is a message to be sent. The client will not proceed with the transmission of a new line until the transmission of the previous line has been acknowledged by the server (meaning the server correctly received the message). The client must also use a timeout/retransmission mechanism: if no ack is received after 15 seconds, the datagram is retransmitted. After 3 attempts, the client will give up transmission, output an error message to the standard output and proceed with the next input line.
12. The C files of the client must be saved under the directory client, while the C files of the server must be saved under the directory server. All the files must be included in a single zip archive created with this bash command:
zip socket.zip client/*.c client/*.h server/*.c server/*.h
Do not include the files used to test the protocol, but do include all the source files that are necessary to compile client and server (it is possible to use source files from the book by Stevens, but these files need to be included).