Answered step by step
Verified Expert Solution
Question
1 Approved Answer
JAVA PROBLEM Simulate a Local Area Network. You have Computers that are threads and produce messages. Each computer is defined by a MAC. The message
JAVA PROBLEM
Simulate a Local Area Network. You have Computers that are threads and produce messages. Each computer is defined by a MAC. The message has a content ( a string), the destination MAC and the origin MAC (of the computer that produced it). When a computer produces a message, it sends it to the waiting queue inside the switch which is also a thread. The switch maintains a Map < MAC, Computer> which it completes each time it receives a message from a computer not in the map. When the switch receives a message it consumes it from the waitingQueue and has two possibilities:
The Destination MAC is in the switch`s map. Then the message is sent to the computer with the corresponding MAC.
The Destination MAC is not in the switch`s map. Then the message is sent to all the computers
When a computer receives a message it prints it on the screen. Each Computer creates a new message each 20 ms with a random Destination MAC to a total of 10 messages.
Implement the classes and create a Main class in which you will instantiate 5 computers and 1 switch.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started