CSC 290 Assignment 2: SUN RPC Due Tuesday 2/11 Following the example in class, write a RPC client and server program. The server should act as a relay between different clients (you'll need to create two separate client programs). The idea is for clientA and clientB to pass information between eachother using the server as a relay. They need to pass structures consisting of a pair of integers. More specifically, if clientA wants to send a struct to B, it will call some RPC function sendtoB. When clientB wishes to retrieve the item, it will call a function "getfromA". ClientB sends to A using a similar mechanism. The server needs to maintain a buffer so that A can send multiple messages to B asynchronously (i.e., A doesn't have to wait for B). Points for thought: The buffer on the server is necessarily of limited size. What happens when A sends to B but the buffer is full? The logical behavior at this point is for the server to not return until B has taken something out of the buffer. However, this scenario would likely require concurrent processing (e.g. multi-threading). Conduct the following experiments: 1. Define some global variable, say int x = 1; inside the server code. Define a function that changes this variable, say x++; Using two distinct client processes, call this function twice. Using some other means (perhaps another function), determine the final value of x. The purpose of this exercise is to find out if the server created a separate process, with a new memory space, to respond to each new client request. 2. Create a situation in which if B calls getfromA but there are currently no messages, getfromA goes into a loop : while (!message) {}. While B waits for the remote procedure to return, issue another client-side request (from a different) process: sentoB, which tries to insert something in the buffer for which B is waiting for. Does B return sucessfully with the message, or will it time out or hang? The purpose of this experiment is to determine if the built-in rpc service mechanism use any kind of concurrency at all. Does it uses processes, threads, or is it a simple loop.