The client from Assignment 1 took two command-line parameters to indicate where to find the(single) server and communicated with it using either UDP or TCP sockets. In a more generalsetup, the service...

The client from Assignment 1 took two command-line parameters to indicate where to find the(single) server and communicated with it using either UDP or TCP sockets. In a more generalsetup, the service would be replicated, offered by multiple servers. You have to develop a clientthat will be capable of contacting an (unknown) number of servers, assuming that the applicationstate (rooms, days, reservations, etc.) is fully replicated at each server. The communicationapproach best suited to this task is the use of IP multicasting,. An online description of IPmulticast in Python is available at https://pymotw.com/2/socket/multicast.html and I will go overthe example in class as well. As IP multicasting only works with DatagramPackets, your clientservercommunication has to be based on datagram sockets (the sample solution to Assignment 1is an example). To keep this assignment simple and straightforward, assume that the multicast isordered and reliable: every server receives every multicast datagram and in the same order.While this is not true in general for IP multicasting, it is a reasonable assumption in a LANenvironment with a shared media such as Ethernet (or more strongly on a single PC where we donot communicate over a network at all). Therefore, as each server has the same initial applicationstate and will process the same requests in the same order, the internal server state(s) will remainconsistent. As servers do not know how many other servers are currently running, each serverwill reply to each request. However, your client should identify multiple responses to the samerequest and display only the first response it receives.On the client side, one problem to solve is that you will, in general, receive multiple (identical)replies to each request. As the client does not know how many servers are up and running,you need to find a way to accept in essence an arbitrary number of replies, though youshould only display the first one. To simplify user interactions, your client should only accept anew user command from the terminal AFTER having received that first response to a priorrequest. However, as a client has no knowledge of the total number of servers, you cannot blocka client until all servers replied. In addition, replies may be arriving out of order: if a clientmakes two successive requests, a slow server could reply with a (duplicate) reply to the earlierrequest when your client is already waiting for replies to the second request.On the server side, a few issues need to be address as well. For starters, the command-lineinterface will change, as the user will have to specify not only the port number, but also themulticast address a server should listen to. In addition, it should be possible for a new server tostart up and join the multicast group midway through a sequence of client interactions. Yoursolution has to ensure that the new server’s internal state is consistent with the state of everyother server. If you have more than one server running, you should also be able to terminate oneof them and have the client continue execution as if nothing happened.When developing your code, you should run the server(s) on your machine, listening to the samemulticast socket. To test the multicast functionality, you need to use a multicast IP address, forexample 235.1.1.1. You should test your solution running a combination of scenarios (n clientsand 1 server, 1 client and m server, n clients and m server – with some servers “crashing” and “restarting”).Submission RequirementsSubmit your solution using cuLearn. Your solution should, at the very least, provide an implementation of the client (in file Client.py) and the server (in file Server.py). Do NOT submit a ZIP file or any other archive, rather submit individual files. You also do not need to submit the input *.txt files. Both client and server take two command-line parameters: a multicast group IP address and a port number. So we should be able to start up clients and servers as follows:python Server.py 235.1.1.1 55555python Client.py 235.1.1.1 55555Again, please note that on Linux and MacOS, you have to ensure that you are using Python3, so you may replace python with python3. Your programs should run as is with the current version of Python (3.9.1), and the code should be well documented. Marks will be based on:• Completeness of your submission• Correct solution to the problem• Following good coding style• Sufficient and high-quality in-line comments• Adhering to the submission requirements
Mar 02, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here