Question: 1. Write a TCP client application named Compute Client.java that reads from the keyboard an integer value followed by an arithmetic operator (+ or

1. Write a TCP client application named Compute Client.java that reads from the keyboard an integer value

1. Write a TCP client application named Compute Client.java that reads from the keyboard an integer value followed by an arithmetic operator (+ or *) which is also followed by another integer value. It then sends these input values to the server application in this order, and then receives from the server application the result of the application of the arithmetic operator on the two numerical values that it outputs on the screen. Use 6066 as the the server application port number. 2. Write a TCP server application named ComputeServer.java that does the following: a. Define an instance of the ServerSocket class. b. Then in an infinite loop, do the following: i. Accept a connection from a client application. ii. Read the integer value which is followed by an arithmetic operator (+ or *) and which is also followed by another integer value from the client application. iii. Perform the specified operation on the values and send the result back to the client application. iv. Close the stream and the connection. Use 6066 as the the server application port number. 3. Type and execute the TCP server application ComputerServer.java in one Command Prompt window and then the TCP client application Compute Client.java in two or three other Command Prompt windows. You stop the ComputerServer application by closing its Command Prompt window. Note: read the operator as follows: char op = scan.next().charAt(0); then use the method write Char(op) to write the operator to the output filter in the server, use the method readChar() to read the operator. There must be a space before and after the operator. Go to Settings to activate Wir

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Certainly here is an example of a TCP client and server application in Java as per your requirements ... View full answer

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!