Chat with us, powered by LiveChat If you are running the client and server on two different devices over the same network (e.g., your home network), how to know the IP of the server? - STUDENT SOLUTION USA

Parallel Computing and Distributed Systems

Assignment 2 (10 points)

Carefully read the shared client.java and server.java files along with the comments placed per command. Run the server project
first, then run the client project. These projects create a chat between the client and the server. Through the terminal window of the
client, you can start writing some statements, and on clicking enter, you should find these statements on the terminal of the server
side along with responses back from the server displayed on the client side. This chat will keep on until the client sends “exist” as
a command and clicks enter; this will terminate the connection established as well as the read and write streams on the two sides.

Task1 description (5 points):

In this assignment, you will extend these shared files to implement an interactive two-tier communication application using network
sockets. Usually, the client and server applications reside on two different devices (e.g., two computers, a smartphone and a
computer). But, to keep this lab simple, you can run both client and server applications on the same computer.

• If you are running the client and server on the same device, the IP of the server will be “localhost” or “127.0.0.1”
• If you are running the client and server on two different devices over the same network (e.g., your home network), how to know the IP of the server?

• If you are running the client and server on two different devices over different networks – check the VPN section below.

The client hosts the user-interface layer where the user can send command(s) to the server. The server hosts both the processing
and data layers to handle the incoming commands from the client side on stored data. The data layer at the server side keeps a
dynamic list (ArrayList) of integers (initially empty) named as inputValues to handle (add/remove) data to/from the user.

The user at the client side enters a command through the terminal (e.g., of your IDE) and then waits for a response back from the
server to be able to enter another command. The following table shows the different supported commands that the user can send to
the server side, along with the proper handle from the server side and expected responses. The client side should print a list of the
supported commands to the user to help them write the correct formatted command. If the user sends any other command or a
supported command, but in a different format, the server should ignore the received message and respond with “unsupported
command” without exiting either the client or the server.

A command from the client to the server is a JSON object, with a unique identifier as the key and the actual instruction as the value.
A response from the server to the client is also a JSON object, with the iden

 

error: Content is protected !!