Hey! I am making a chat application which uses multi hop forwarding. For this, I need each node to send their routing tables to their neighbours so thayt every reachable node can have one table with the destination ID, number of hops, and the next Hop to get to this destination as one entry in the table (Note: hops to your own ID is 0, to your immediate neighbour is 1). I tried to implement this by building an inital table using a hashmap, with the key as the destination ID and the value as an instance of a class I made, called Route. This class accesses number of hops and next hop ID. I initialize the table with the node's own ID as the only entry and broadcast it to my neighbours. They add my ID to their table with the number of hops being incremented by one. This all works fine, but many times, when I try to start 4 instances of the program, most nodes do not have a correct table. They usually have less than 4 entries which is wrong, all of them should have 4. Does anyone have any idea as to why this happens? (Note: I have implemeted collision avoidance too)
Also, how could I broadcast a caht from one node to everyone in the system? The only idea I have is flooding the network but is there any other way? Can acknowlegements work in this method too?
Thanks