Question: Create a Chat Application using Sockets. In this assignment, you will become familiar with the basic principles of TCP Protocol and possibilities of a chat
Create a Chat Application using Sockets. In this assignment, you will become familiar with the basic principles of TCP Protocol and possibilities of a chat system consisting of a server and client.
Unlike UDP, TCP (transport control protocol) is a connection oriented protocol, that is best described by a bidirectional pipe, where on both sides data can be sent and received. First the socket has to be created and opened. After that data can be sent or received from it. To finish using the socket is has to be closed. In Java it is very easy to use sockets. There are two kind of sockets using TCP in Java: ServerSocket and Socket. A ServerSocket can wait for a connection of a Socket on a specified port. After accepting the connection server and client can exchange data in either one or bothways.
Requirements:
The Chat Application needs to include two parts: the chat server, and multiple instances of chat client.
The client should be able to register to the server on a specific port. Client should also provide a name/alias during registration.
Once connected, client can send text messages to server.
The messages received by the server should be broadcasted to all connected clients. Message broadcasted by the server should include which client it originated from, date and time.
Client can type Quit/QUIT to end the chat session. All connected clients should be notified if another client quits the chat session.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
