Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In in this project, you are require to implement a hybrid P2P chatting application using TCP socket programming. You are allowed to use Java. You

In in this project, you are require to implement a hybrid P2P chatting application using TCP socket programming. You are allowed to use Java. You code should not be dependent on any development environment. That is, is should be compliable using command prompt (or shell) on Ubuntu (Bash) or MacOS.

Project Description

You are required to build a TCP socket based hybrid P2P chatting application. At the beginning, a server with known IP (use a loopback address/DNS such as localhost) and port number (a fixed one). Then, you will be required to start 5 other clients. For each client, once it is connected to the server, they exchange a greeting message between a newly connected client and the server as well as existing clients. The exact message is Client $ID: initiated. Where $ID is the ID of the client. The ID of the client is given when starting the client. That is, you can start a client process by typing.

./client.out $ID $PORTNUMBER

Where $ID is the ID of the client and $PORTNUMBER is the port number of the client. As mentioned above, the ID and the Port Number of the server can be hard-coded on the client side. Therefore, you can simply start the server by typing.

./server

Now, once you start a server process and 5 client processes, and make them connected, you should be able to use either the server or one of the client to exchange messages among them. That is, a user should be able to type messages on one of them using the terminal, and that message should be broadcasted among them.

Finally, type a message Exit on the server. Then, the server should be terminated after a sending a message Server: terminated. To all of the clients. This message should be displayed on the screen of each client.

After the phase 2, you are required to restart the server. Then, each client should restore the connection between them and exchange the following message between the server and each client (no broadcasting).

That is, Server:initiated should be sent to the client first, and this should be displayed on the screen of the client. Then, Client $ID: reconnected should be sent to the server, and this should be displayed on the screen of the server.

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_2

Step: 3

blur-text-image_3

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

Neo4j Data Modeling

Authors: Steve Hoberman ,David Fauth

1st Edition

1634621913, 978-1634621915

More Books

Students also viewed these Databases questions