11 posts
Posted 04 October 2013 - 03:24 AM
Hi all!
Recently i started writing a relay program with socket support.
Relaying is simple: relay packet has a field with full route to receiver computer (and the each node deletes the own node ID from route). So, with manually made routes it barely works. But when i try to make an automatic route detector, it results or in full fail (the makeroute packet doesn't go in right way), or in echo-storm around all net.
So, tl;dr: i need a simple idea (or a small bit of code), how can i make a route from one computer to another, without loading the whole net (it's really large) with broadcast messages in hope that it wille be delivered to right computer.
Thanks.
8543 posts
Posted 04 October 2013 - 03:29 AM
Each computer knows about the nearest hosts. Routing computers tell all computers in range about the computers it knows how to reach, and how far away they are (network jumps, not physical distance). This means that routing computers end up telling each other about all the routes they know about, and the information eventually propogates through the network. When you want to send a packet, you check the list of hosts and see where to send the actual packet. Each router does the same, passing the packet along to the next computer in line.
11 posts
Posted 04 October 2013 - 04:00 AM
Each computer knows about the nearest hosts. Routing computers tell all computers in range about the computers it knows how to reach, and how far away they are (network jumps, not physical distance). This means that routing computers end up telling each other about all the routes they know about, and the information eventually propogates through the network. When you want to send a packet, you check the list of hosts and see where to send the actual packet. Each router does the same, passing the packet along to the next computer in line.
So, I need to scan the net by asking each node in a row and adding the packet's route by each node, and when the broadcast series comes to receiver computer (which ID is written in field 2 of mkrt packet), it reverses the route and sends a "makeroute_correct" message by the reversed route, that's it?
And, yeah, to prevent echo, i think, each makeroute packet will have a randomly generated ID, and if a node receives a mkrt packet with the same ID as previous it will just ignore it.
8543 posts
Posted 04 October 2013 - 10:26 AM
Hah, no. The point is to avoid generating whole routes. The idea is that every computer find out what computers are in range, but only routers share that information with other computers. Eventually, with routers sharing information between each other and their nearby computers, every computer will know all of the computers that exist on the network. Instead of having a complete route to them, they simply need to know which nearby computer to send the packet to. That computer looks at their table and determines where to send it to, etc.
You might take a look at LyqydNet for more information.