Question: JAVA Simulate a Local Area Network. You have Computers that are threads and produce messages. Each computer is defined by a MAC. The message has

JAVA
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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!