Question
Programming assignment in C between a client and server: This project consists of building the code to run the link-state algorithm in a router. Assume
Programming assignment in C between a client and server:
This project consists of building the code to run the link-state algorithm in a router. Assume the topology has N routers. The following information will be available: - Router ID, which is its index into the tables below, is given at the command line. - Number of nodes, N, in the topology will be given by the command line. - Table with costs, NxN, will be obtained from file1 (name given at the command line). - Table with machines, names, IP addresses, and port numbers, Nx3, will be obtained from file2 (name given at the command line). Your main data will be: - Neighbor cost table contains the cost from every node to every node, initially obtained from file1. - Least cost array obtained with the link state algorithm. Your code will have 3 threads: - Thread 1 loops forever. It receives messages from other nodes and updates the neighbor cost table. When receiving a new cost c from x to neighbor y, it should update the cost in both costs: x to y and y to x. - Thread 2 reads a new change from the keyboard every 10 seconds, updates the neighbor cost table, and sends messages to the other nodes using UDP. It finishes 30 seconds after executing 10 changes. You may execute this part in the main thread. - Thread 3 loops forever. It sleeps for a random number of seconds (10-20), run the algorithm to update the least costs. After the algorithm executes it outputs the current least costs. You will need a mutex lock to synchronize the access to the neighbor cost table. The messages between the routers will have 3 integers:
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