The Binary Countdown Protocol is a contention-resolution MAC (Medium Access Control) protocol used on shared broadcast channels. When multiple stations want to transmit simultaneously, each station broadcasts its address as a binary number, bit by bit from the most significant bit (MSB) downward. Stations with a 0 bit at a position where another station has a 1 bit drop out of the contention. The station whose complete binary address survives the entire comparison wins the channel and transmits its frame. This guarantees that the station with the highest binary address always wins each contention round.
This C++ program simulates the Binary Countdown Protocol. Each frame is treated as an 8-bit binary number. The program converts each frame to its decimal equivalent (which represents the station’s binary address), then announces the frames in descending priority order — highest decimal value first — as they would be granted channel access.
Distance Vector Routing (DVR) is a decentralised routing protocol where each router maintains a table containing its estimated shortest distance to every other router in the network. Routers exchange these distance vectors with their neighbours, and each router updates its own table whenever a shorter path is discovered. The algorithm continues iterating until no table changes occur — a state known as convergence. DVR is the conceptual basis for real-world protocols such as RIP (Routing Information Protocol).
This C++ program simulates DVR on a user-defined network. The user specifies the number of nodes and the distances between directly connected node pairs. The program iteratively updates routing tables until convergence and then prints each node’s final routing table showing the shortest distance and the next-hop node to reach every destination.
Socket programming is the foundation of network communication in Java. A socket is one endpoint of a two-way communication channel between two programs running on a network. Java provides the java.net package with high-level abstractions — ServerSocket for the server side and Socket for the client side — that handle the underlying TCP/IP details so you can focus on reading and writing data streams.
This example implements a simple interactive TCP chat between a server and a client. Both sides can send and receive messages. Either side can type Q or q to close the connection gracefully. The server listens on port 5000; the client connects to localhost:5000.
The Bit-Map Protocol is a contention-free MAC (Medium Access Control) layer protocol used to coordinate which stations are allowed to transmit on a shared channel. Before any data frame is sent, each station broadcasts a single bit during its reserved slot in a contention slot period: a 1 signals that the station has a frame ready to send, while a 0 means the station has nothing to transmit. Once every station has announced its status, transmissions occur in station order, eliminating collisions entirely.
This C++ program simulates the Bit-Map Protocol. The user specifies the number of stations and their ready/not-ready status. The program reads each station’s status, then announces which stations are ready to transmit in station-number order.
Cyclic Redundancy Check (CRC) is one of the most widely used error-detection techniques in data communications. The sender treats the data frame as a binary number, appends zeros equal to one less than the generator polynomial length, and then divides the extended frame by the generator using XOR (modulo-2) division. The remainder — called the CRC bits — is appended to the original frame before transmission.
At the receiver, the same division is performed on the received frame. If the remainder is zero, the frame arrived without errors; a non-zero remainder indicates corruption. This C++ program demonstrates both the sender-side CRC generation and the receiver-side error check for a user-supplied frame and generator.
Dijkstra’s Algorithm is a classic greedy algorithm for finding the shortest path from a single source vertex to all other vertices in a weighted graph with non-negative edge weights. It maintains a set of visited vertices and a distance array. At each step it selects the unvisited vertex with the smallest known distance, marks it visited, and relaxes (updates) the distances of its neighbours. This process repeats until all vertices have been visited.
This C++ program reads a cost matrix from the user (entering -1 for absent edges and 0 for self-loops), runs Dijkstra’s algorithm from a user-specified source vertex, and prints the shortest distance and parent vertex for every node.
This is an outdated post! Please click here to see latest version of Implementation of Distance Vector Routing (DVR) Algorithm in C++
The Distance Vector Routing (DVR) Algorithm is a fundamental routing algorithm used in computer networks to determine the shortest path between nodes. It is based on the Bellman-Ford algorithm and operates by sharing routing tables among directly connected nodes to update their knowledge about the shortest paths.
In this blog post, we will discuss the implementation of the DVR algorithm in C++, go through the code step by step, and explain its output.