Starting from:

$25

CS4150 - lab8 - Solved

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 specified 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. This UDP server on h3 is expected to square the value received from h2 and send the result to h1 over a TCP connection.

Create a program on host h1 which takes three arguments. The first 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 specified, 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, information about h1 such as IP address and server port

numbers should not be hard coded in the programs running on hosts h2 and h3.

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.
[70]
Hint: You can find some pointers at inetd deamon
[30]
End of paper

More products