$29
1. You are given a virtual network with three host h1(192.168.1.2), h2(192.168.1.3), and h3(192.168.1.4).
Create four TCP servers on h2. There servers are ADD server (port number 12500), SUB server (port number 12501), MUL server (port number 12502), and IDIV server (port number 12503). If a client supplies two integers to these servers, they should perform the operation speci ed in their name. Note that IDIV stands for integer division.
Upon successful computation, these servers should send the computed value to a UDP server on host h3. The UDP server on h3 should square the value received from h2 and send the result back to the client over a TCP connection.
Create a program on host h1 which takes three arguments. The rst two are integers and the third is the operation that needs to be performed on these integers (ADD, SUB, MUL or IDIV). Then, depending on the operation speci ed, your program should send the computation request to one of the servers on host h2, and display the result which it gets from h3.
Note: In your implementation, IP address of h1 should not be hard coded in the programs
running on hosts h2 and h3.
[70]
2. In the above exercise, all the four server are active all the time. Create a simple TCP inetd
deamon on h2 which will create instances of these servers based on demand. Note that you
may need to modify the servers you have already created on h2 to work with the inetd daemon.
Hint: You can nd some pointers at inetd deamon
[30]
End of paper