Remember my post about me having the algos but being lazy about implementing them? Well. here is what I was thinking when I posted that:
Bittorrent uses a single tracker
Freenet uses a slow broadcast message system
I would use multiple trackers, responsible for specific parts of the namespace(like, if your IP starts with a number less than 128, you go to tracker1, otherwise, tracker2) so I thought I was done with network topology.
Well,I was mistaken, it gets a lot more complicated than that.In fact, even with perfect knowledge of all nodes(not practical), finding an optimal topology involves extrapolating what each node is going to query, that is, it involves A.I.Amazing. I could easily spend 2 years just thinking about this subject before reaching an agreeable solution. Perhaps I should just use one-tracker-for-all and then make things on the go?
You wouldn’t believe how many functions a network must have in order to work fast(or merely work). I know what I need(the algos), just feeling too lazy to implement them. 🙂
The connection problem has been solved already, I realized that even if one connects randomly we end up with a fully connected group of networks. There are biases, which may would cause some problem if there were few connections per node and a large number of nodes, but that is not the case and the biggest bias(nodes tend to cluster around regional nodes) could be solved quickly by a simple algorithm prioritizing farther IP addresses, even if with few connections by node. So… what is the next challenge to create the exchange of:
There is good info and bad info, how can I make good info travel as fast as possible to as many nodes as possible while limiting the spread of bad info? My next challenge. If solved, will greatly improve my living standard(when implemented).
Network topology could be the reason I’m stuck.
Let n1 be the first and only tracker, let n2,n3,n4 and nM be nodes joining after n1,n2,n3..nM-1
Naive Approach(fully connected)
A network with J nodes will have J-1 connections per node. For a maximum of 100(my initial target), that would limit the network size to 101 nodes.
Naive Approach, then Least Connected First
n1-n2-n3,n2-n1-n3,n3-n1-n2(next paragraph is Least Connected First)
(tell n1 she(n4) arrived)
n1-n2-n3-TEMPORARY-n4,n2-n1-n3,n3-n1-n2,n4-TEMPORARY-n1(n1 tells n2 that n4 has only 1 connection)
(n2 sees that n1 has 3 connections(counting tmp))
So we have already surpassed a fully connected network number of maximum nodes if connections are capped(at 2)
Now, I need to continue this later and generalize a maximum number of connected nodes if the algo least connected first is used with max connections X (maxNodes= topologyAlgo(MaxConnectionsPerNode))
Just realized today that you need an e-mail to be registered with gravatar before you can use their image generator. I thought they generated images for any hash, I was even wondering what was their business model, 🙂
After I discovered you need to tell them an e-mail visited your website or had his avatar requested I went “Ah… I see what you are doing there”, hahaha
I sort of did a quick fix, images are now a background with the color modified by your md5 hash. I plan on doing cooler stuff latter regarding the avatar(it will be animated)
But… before all that, my plan of using plain Internet Protocol(no UDP/TCP) may be a little far fetched after all.
Msg id(that is re-hashed every msg to show continuity)
Acknowledgement of messages.
Broadcasting(I heard UDP could do that, but I don’t think they mean sending to users of an specific program)
Requesting more nodes(this one doesn’t come free with TCP/UDP)
Giving said nodes(same as above)
And I am actually taking shortcuts wherever possible. HTML instead of canvas drawing; leaving authentication for later; leaving cool avatars for later.
The peer to peer protocol and search is all that I’ll do before releasing the first public version.
I was having trouble making my server/client(it is going to be a node) communicate with firefox(for purposes of testing), I wasted some time learning what “hole punching” is and even thought I was going to have an uphill battle with this issue. Alas, VB has a TcpListener with the following function: AllowNatTraversal. All you need to do is to bind your external IP address on your TcpListener and then call AllowNatTraversal(True). Done. You can now receive stuff from the client 😀
Thank you Bill Gates.
Now, on a side note, how do they do it? Last time I checked “hole punching” required a non-firewalled server and didn’t work very well trough TCP. Hmmmm. Perhaps some other method of NAT traversing? I hope I’m not building something that will rely on a centralized server. It would kill the point of having P2P.