Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

build a simple chat application using UDP sockets. step 1: Simple messaging Client app sends a packet to Server app using a UDP socket Server

build a simple chat application using UDP sockets.

step 1: Simple messaging

Client app sends a packet to Server app using a UDP socket Server app shows the message received Client IP address Client Port number Message content (remove paddings if applicable)

step2:Message handling Define a message format so we can have a few types of messages Message type: integer User name: String Message content: String You can define your own data structure (Explain it in your report) You may want to use JSON format for this. Some conversion libraries are available. e.g. gson Client app creates and sends three types of messages: Join (type 0): sent once at the beginning of client-server communication Post (type 1): may be sent multiple times after the join message and before the leave message Leave (type 2): sent once at the end of client-server communication Server app saves the client info (IP address and port number) if it receives a join message Show the saved entry on screen for confirmation Note: Since a client is characterized by (IP and Port), you can mimic multiple client scenarios even on your local device by using multiple port numbers. Server app shows the message content if it is a post message Server app removes the client info (IP address and port number) if it receives a leave message Show the removed entry on screen for confirmation

Step3: Broadcasting posts Server app sends the received post message to all the clients in its client list (This client list is created by the join messages.) Client app receives this broadcast message and shows it on screen This requires you to use multi-threading since the user needs to send and receive at the same time You can add a new thread that continues waiting for the messages coming from the server using the same UDP socket

need to submit source codes (.java files) and a brief report (pdf file). The source codes should be appropriately commented The roles of each class and method If conditions The report should include the screen captures from your test runs and brief explanations Explain what scenarios you tested (how many clients, what were their IP/ports, your message format design, ...)

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

Data Communications and Networking

Authors: Behrouz A. Forouzan

5th edition

73376221, 978-0073376226

More Books

Students also viewed these Computer Network questions

Question

Name the two major categories of transmission media.

Answered: 1 week ago

Question

Repeat Example 25.4 using the service of TCP.

Answered: 1 week ago

Question

4.1 Describe listening problems and their possible solutions

Answered: 1 week ago