please use the given python code on the picture to answer this question. otherwise please dont give random codes.
3: UDP DESCRIPTION In this assignment, students write code that can send and receive UDP broadcast packets. This is based on Listings 2-1, 2-2, 2-3, and 2- 4 in Foundations of Python Network Program- ming, 3rd Edition, but is simpler than any of them. The book, up through that point, should be read. (See the relevant portion of the Computer Net- works textbook for the meaning of the particular IP address that you will need to use for this as- signment.) OBJECTIVES To demonstrate knowledge of UDP broadcast by writing code to do so. DIRECTIONS Fill in the relevant portions of the provided skele- ton file to complete the assignment and make it function as desired. SUBMISSION INSTRUCTIONS Look for the appropriate Dropbox on on D2L Brightspace and upload your file to there. 3 assignment04.py > No Selection 1 import argparse, socket, sys 3 MAX_BYTES = 65535 2 4 5 # server 7 8 11 13 14 75 20 21 22 6 def server (port): #@ make the socket and assign it to sock #@ assign the broadcast IP address to the variable named interface 9 #@ bind sock to the pair of interface, port 10 print('Listening at', sock.getsockname()) while True: 12 data, address = sock.recvfrom(MAX_BYTES) text = data.decode('ascii') print('The client at t) says (!r}'.format(address, text)) 16 # client 17 def client (port): #@ make the socket and assign it to sock 19 #@ assign the broadcast IP address to the variable named hostname sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) #@ connect sock to the pair of hostname, port print('Client socket name is {}'.format(sock.getsockname())) 23 24 text - input("What data should we broadcast?") 25 26 #send datagram while more to send 27 while len(text): data = text.encode('ascii') # send datagram Sock.send(data) # get next datagram to send text - input ("What data should we broadcast?") 35 36 37 if __name__ == '__main__': choices = ('client': client, 'server': server) parser - argparse. ArgumentParser(description='Send and receive UDP') parser.add_argument('role', choices-choices, helpe'which role to take') parser.add_argument('-p', metavara'PORT', type-int, default=1860, helpw'UDP port (default 1960)') args = parser.parse_args() function = choices[args.role) function(args.p) 29 30 31 32 33 34 #main 38 39 40 41 4 45