Burak, what you're trying to do sounds a little like the Freenet Project. https://freenetproject.org/ If you can't use their code directly you can certainly get some inspiration or learn how they solved similar problems. -- Jeff Ollie