.Implement a client and server using Java - .The client sends an integer to the server - The server will send back the received integer - multiplied by 100.; if the client sends 4 then the server will send back 400 to the client Just send two files (Client.java and Server.java) -
Added by Erin R.
Close
Step 1
First, we need to create a server that listens for incoming connections from clients. We can use the `ServerSocket` class to achieve this. Server.java: ```java import java.io.*; import java.net.*; public class Server { public static void main(String[] args) Show more…
Show all steps
Your feedback will help us improve your experience
Dominador Tan and 63 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Develop a Java application that includes a Java client and a Java server. Each of them should run in its own command window and communicate via a TCP connection on two computers. Note that you need to collect results of this project using two separate computers. The server and the client should be started in the following format: > java server > java client [IP-address] [input-data-file] [output-data-file] For example: java client 192.168.0.5 data10000B.txt out10000B.txt The client will read the first input argument (args[0]) to get the IP address of the server, and the second input argument (args[1]) to get the name of the input-data-file. The output-data-file (args[2]) should contain the same data as the input-data-file that the server sends back to the client. All the server does is listen to incoming socket connections, and once a connection is established, simply echoes all incoming data back to the sender. Note that you need to make sure you read the whole file before you send anything, send the entire message in one operation, and flush the stream after sending. (a) After establishing a socket connection with the server, the client will determine the estimated Round Trip Time (RTT) between the server and itself. The client will accomplish this by sending messages (the content of the 1B data file: data1B.txt) to the server and counting the time elapsed before it receives the messages back from the server. Run the client 3 times for the same input-data-file and then average their results to come up with an average RTT value. Do NOT count the time that the client spends on reading data from the input-data-file or writing data to the output-data-file.
Akash M.
Write an application that asks a user to enter an integer. Display a statement that indicates whether the integer is even or odd. Save the file as EvenOdd.java.
Shelayah R.
Need huge help with Server programming JAVA PROGRAMMING Create two (2) programs: 1) an iterative (single-threaded) server that accepts requests from clients, and 2) a multi-threaded client capable of spawning numerous client sessions that connect to the server. The server and client programs must connect to the same network address and port. The iterative (single-threaded) server should handle one client request at a time (serially). The Java ServerSocket object caches client requests automatically. The iterative (single-threaded) server must support the following client requests: 1. Date and Time - the date and time on the server 2. Uptime - how long the server has been running since last boot-up 3. Memory Use - the current memory usage on the server 4. Netstat - lists network connections on the server 5. Current Users - list of users currently connected to the server 6. Running Processes - list of programs currently running on the server Create a multi-threaded client that transmits requests to the server on a specified network port. The client program must be able to spawn multiple client sessions. When the server program is launched, the server should: - Listen for client requests on the specified network address and port - When a client request is received, the server should: - Determine which operation is being requested - Perform the requested operation and collect the resulting output - Reply to the client request with the output from the operation performed - Perform any necessary clean up activities - Go back to listening for client requests When the client program is launched, the client should: - Request the network address and port to which to connect - Request the operation to request (refer to the list above) - Request how many client requests to generate (1, 5, 10, 15, 20, and 25) - Collect the following data: - Turn-around Time (elapsed time) for each client request - The time required for the client request to travel to the server, be processed by the server, and return to the client - Total Turn-around Time (sum of the turn-around times for all the client requests) - Average Turn-around Time (Total Turn-around Time divided by the number of client requests)
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Watch the video solution with this free unlock.
EMAIL
PASSWORD