Question: YOUR CLIENT / SERVER PAIRYou are to write two programs: 1 . A client program that will connect with your serverand ask for the public

YOUR CLIENT/SERVER PAIRYou are to write two programs:1. A client program that will connect with your serverand ask for the public key of a given user.2. A server program that will read a list of pairs (userID, public key) from a file, wait for connectionrequests from client processes, and send them backeither a string containing the requested public key ora code notifying them that the user is not in thedatabase.THE SERVER PROGRAMYour server should start by prompting the user for a filename:Enter a file name: keys2.txtThis file will contain pairs of user IDs and public keys asin:jorge@uh.edu a1b234c4567df123abceva@rice.edu 5672c4567df123abc54Both entries will never contain any white spaces. Itwill then store the contents of the file into a table. Yourserver should then prompt for a port number as in:Enter the server port number: 2468It will then:1. Create a datagram socket in the Internet domain,2. Do a bind()to bind the socket to the specified portnumber.COSC 3360Operating System FundamentalsAssignment #1: A public key serverDue on Wednesday, November 6 at 11:59:59 PM3. Enter an infinite loop where it will repeatedly do arecvfrom() to receive user IDs from its clients then asendto() to reply with the corresponding public keys.For debugging and grading purposes, your servershould print out the user ID it receives and its status as:jorge@uh.edu: Found a public keyrick@tamu.edu: Not in the databaseYour server will keep accepting client requests untilit receives a Done message from one of its clients. In thatcase, it should terminate after printing:Terminated by user request.THE CLIENT PROGRAMYour client should start by prompting the user for aserver hostname and a server port number as:Enter the server hostname: localhostEnter the server port number: 2468It will then prompt for a user ID as:Enter a user ID: jorge@uh.eduIt should then create a datagram socket, do asendto() to send the user ID to the server then arecvfrom() to get its reply. Once this reply has arrived,the client should display the outcome of the query as:The public key for jorge@uh.edu is a1b234The user rick@tamu.edu is not in the database.Unlike the server, each client will only handle a singlerequest

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!