Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Practice how to use basic JAVA programming skills and implement two JAVA programs using sockets for data communication between a server and a client program.

Practice how to use basic JAVA programming skills and implement two JAVA programs using sockets for data communication between a server and a client program. In this assignment, you are required to write two JAVA programs (a client and a server). The client program sends a message to the server program using TCP sockets, and then the server program display on its screen the message received from the client. JAVA Programming Examples: 1. JAVA socket programming examples: https://www.digitalocean.com/community/tutorials/java-socket-programming-server-client 2. JAVA programming examples of writing/reading data to/from files: https://www.tutorialspoint.com/java/java_files_io.htm

Requirements:

1. You need to write two JAVA programs, one client and one server program. Each program can have one or more JAVA classes.

2. You client program MUST process the input file (client_input1.txt), and then sends the processing result to your server program. The server program then displays the result on its screen.

3. Run your server program first, and then run your client program with the input file client_input1.txt. Take a screenshot of the running output for each of your two programs.

4. Repeat Step 2 and 3 above for the input files client_input2.txt and client_input3.txt, respectively. Totally, you will have 6 screenshots (2 for each input file).

5. All three input files client_input1.txt, client_input2.txt and client_input3.txt are attached to this assignment. You will need to run both the server and client programs three times, one for each input file. How does the client program process the input file client_input.txt? Each input file client_input#.txt contains a list of positive integers separated by a comma. Assume that the input file contains an ordered list of positive integers such as <5, 4, 3, 2, 1, 1000, 27, 18, 10, 5, 6, 1, 9, 4, 2, 3>. Your client program has to find the largest integer in the list that is the sum of another two numbers after that integer. In the above list, all the integers in red satisfy the condition, and 27 is the largest one among them as 27 = 18 + 9. Your client program MUST find the largest integer in the list that satisfies the condition and then sends it to the server program. Required outputs: Your client program MUST output all the integers in red satisfy the condition Your server program MUST display the largest one among them.

client1

5, 4, 33, 2, 12, 100, 200, 13, 10, 6, 4

client2

5, 4, 33, 2, 12, 100, 200, 13, 10, 6, 41, 5, 4, 34, 2, 1, 101, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 300, 13, 10, 6, 4, 200, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 13, 10, 6, 4, 5, 4, 33, 2, 12, 100, 400, 13, 10, 6, 41, 5, 4, 34, 2, 1, 102, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 13, 10, 6, 4, 103, 13, 10, 116, 4, 5, 4, 3, 2, 1, 100, 500, 13, 10, 6, 4, 5, 4, 33, 2, 12, 100, 200, 13, 10, 6, 41, 5, 4, 34, 2, 1, 101, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 300, 13, 10, 6, 4, 200, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 13, 10, 6, 4, 5, 4, 33, 2, 12, 100, 400, 13, 10, 6, 41, 5, 4, 34, 2, 1, 102, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 13, 10, 6, 4, 103, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 500, 13, 10, 6, 4, 5, 4, 33, 2, 12, 100, 200, 13, 10, 6, 41, 5, 4, 34, 2, 1, 101, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 300, 13, 10, 6, 4, 200, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 13, 10, 6, 4, 5, 4, 33, 2, 12, 100, 400, 13, 10, 6, 41, 5, 4, 34, 2, 1, 102, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 13, 10, 6, 4, 103, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 500, 13, 10, 6, 4, 5, 4, 33, 2, 12, 100, 200, 13, 10, 6, 41, 5, 4, 34, 2, 1, 101, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 300, 13, 10, 6, 4, 200, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 13, 10, 6, 4, 5, 4, 33, 2, 12, 100, 400, 13, 10, 6, 41, 5, 4, 34, 2, 1, 102, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 13, 10, 6, 4, 103, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 500, 13, 10, 6, 4

client 3

5, 4, 123456, 33, 2, 12, 45678, 100, 200, 13, 10, 6, 41, 5, 4, 34, 2, 1, 101, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 300, 13, 10, 6, 4, 200, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 13, 10, 6, 4, 5, 4, 33, 2, 12, 100, 400, 13, 10, 6, 41, 5, 4, 34, 2, 1, 102, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 13, 10, 6, 4, 103, 13, 10, 116, 4, 5, 4, 3, 2, 1, 100, 500, 13, 10, 6, 4, 5, 4, 33, 2, 12, 100, 200, 13, 10, 6, 41, 5, 4, 34, 2, 1, 101, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 300, 13, 10, 6, 4, 200, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 13, 10, 6, 4, 5, 4, 33, 2, 12, 100, 400, 13, 10, 6, 41, 5, 4, 34, 2, 1, 102, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 13, 10, 6, 4, 103, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 500, 13, 10, 6, 4, 5, 4, 33, 2, 12, 100, 200, 13, 10, 6, 41, 5, 4, 34, 2, 1, 101, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 300, 13, 10, 6, 4, 200, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 13, 10, 6, 4, 5, 4, 33, 2, 12, 100, 400, 13, 10, 6, 41, 5, 4, 34, 2, 1, 102, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 13, 10, 6, 4, 103, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 500, 13, 10, 6, 4, 5, 4, 33, 2, 12, 100, 200, 13, 10, 6, 41, 5, 4, 34, 2, 1, 101, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 300, 13, 10, 6, 4, 200, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 13, 10, 6, 4, 5, 4, 33, 2, 12, 100, 400, 13, 10, 6, 41, 5, 4, 34, 2, 1, 102, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 13, 10, 6, 4, 103, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 500, 13, 10, 6, 4, 1000, 1, 600, 1, 3, 400, 5, 4, 33, 2, 12, 100, 200, 13, 10, 6, 41, 5, 4, 34, 2, 1, 101, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 300, 13, 10, 6, 4, 200, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 13, 10, 6, 4, 5, 4, 33, 2, 12, 100, 400, 13, 10, 6, 41, 5, 4, 34, 2, 1, 102, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 13, 10, 6, 4, 103, 13, 10, 116, 4, 5, 4, 3, 2, 1, 100, 500, 13, 10, 6, 4, 5, 4, 33, 2, 12, 100, 200, 13, 10, 6, 41, 5, 4, 34, 2, 1, 101, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 300, 13, 10, 6, 4, 200, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 13, 10, 6, 4, 5, 4, 33, 2, 12, 100, 400, 13, 10, 6, 41, 5, 4, 34, 2, 1, 102, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 13, 10, 6, 4, 103, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 500, 13, 10, 6, 4, 5, 4, 33, 2, 12, 100, 200, 13, 10, 6, 41, 5, 4, 34, 2, 1, 101, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 300, 13, 10, 6, 4, 200, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 13, 10, 6, 4, 5, 4, 33, 2, 12, 100, 400, 13, 10, 6, 41, 5, 4, 34, 2, 1, 102, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 13, 10, 6, 4, 103, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 500, 13, 10, 6, 4, 5, 4, 33, 2, 12, 100, 200, 13, 10, 6, 41, 5, 4, 34, 2, 1, 101, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 300, 13, 10, 6, 4, 200, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 13, 10, 6, 4, 5, 4, 33, 2, 12, 100, 400, 13, 10, 6, 41, 5, 4, 34, 2, 1, 102, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 13, 10, 6, 4, 103, 13, 10, 6, 4, 5, 4, 3, 2, 1, 100, 500, 13, 10, 6, 4, 1000, 1, 600, 1, 3, 400

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essential Data Protection For Estate Agencies In Singapore 2024

Authors: Yang Yen Thaw Yt

1st Edition

B0CQK79WD3, 979-8872095392

More Books

Students also viewed these Databases questions

Question

\ table [ [ , Level of activity, 9 0 %

Answered: 1 week ago

Question

5. Understand how cultural values influence conflict behavior.

Answered: 1 week ago