Imagine this scenario:
- You have a crowd of 1000 blind people who cannot move from their positions. All they can do is listen, speak, and write messages to each other.
- They need to send messages to one another. To accomplish this, everyone shouts their name (everyone has a different name) exactly every 30 minutes. Their individual timer starts when they join the crowd. So, all the shouting isn't all at once.
- Because people cannot shout over the entire crowd, people will relay your request for messages over to other people. So Bob (who's next to Jon) will ask the crowd for messages for Jon as well and forward them in the general direction of Jon.
- There is unlimited paper. Any number of messages can be written. Some of the message on the paper is encrypted but not all of it. The message says who it's addressed to.
What's going on:
I'm writing a P2P cellular service where everyone can send text messages, walkie-talkie, and transfer files. I've repurposed wifi frequencies and am now using both TCP (physical paper message which must always be delivered) and UDP (shouting which doesn't have to make it to its destination but people help it along by repeating the shouting they hear). The towers cannot see each other (they're blind). They cannot move from their location. Each tower on the network sends out a request for messages UDP/shouting for its clients (example: get me messages for number 440-403-432). Each response is in the form of a physical message/TCP transfer. So, you can literally find any tower in the network, by following the path of shouters to that particular node (as the physical message will do). Node requests are made every 30 seconds.
If this protocol gets big, 1 million people, all shouting that they need messages for themselves, being broadcast to every member of the network is going to get very large. I need to find a way to deliver messages more efficiently.