📜 ⬆️ ⬇️

Data transfer protocol like p2p but only smarter

Hello everyone, this is my first post on Habré. I had an idea, and I want to hear the opinion of habrauers, it may have already happened, but for a long time I didn’t see such an idea as a habr reader.

In general, the essence is as follows. Many people know the device peer-to-peer networks and the principle of their foundation, if not, then this is written in detail in the wiki. Pieces of information are transferred from one PC to another.

What if you create a data transfer protocol similar to p2p but only under the browser? I will explain with an example, we have a movie, of course, we shot it ourselves, there is a website (some kind of youtube), we upload the movie to the website - the website processes the video on the server. Then the film becomes free for access and anyone can watch it, just go to the site, download the program from there which, after installation, will create a buffer on the hard disk in which data will be stored. So, the person installed the program, and started watching our movie - data transmitted to it at the beginning of the cycle from the server - because there is no other place, because if too many people immediately sit down to watch a movie, then the author of the movie, if he used p2p technology, simply would not have time to distribute the video at such a speed as to provide several people with watching the movie without delay.
')
So. The server gives the data to the user (s), and since they installed the program that makes a buffer on the hard drive for data storage and accepted the license agreement allowing the site to use this buffer and the Internet connection for further purposes, the movie pieces are stored in this buffer and will be there to be (buffer -% limit on the volume of the disk, when it starts to run out - old data is deleted, replaced by new ones).

Thus, after spreading a few pieces of video to a multitude of users, we will get a centralized p2p network, which will be managed by the main server. The next person who wants to watch our movie online ... in the browser enters the site installs the program that creates the buffer on the hard and presses the play button, at this time the users who watched the movie earlier and in the buffer of which there were pieces of the movie give them to the user who watches the movie. The site in the distribution of the film is no longer involved, but only monitors the process and if the file is unavailable - it loads data from the server.

What we get in the end:
The cost of hosting a video site is small compared to if the server gave each user a full movie.
The user gets the opportunity to watch the movie online, without losing time for the jump (as it happens when using torrent - first you download, then you watch)

Yes, I know that the noob in p2p networks, the server part, the Russian language and the fact that the whole thing is difficult to implement, but what the hell is this cool! For clarity, at least somehow implemented a rough scheme.

image

This can be used on visited sites, which always have good online on some popular video clips, or audio sites ... in general, on projects where you can start / listen / watch the entire type of content in the browser.

He wrote as he could, to formulate the idea more precisely, well, not as simple. Do you think it is promising? Does it have the right to live?
Published, went to sleep.

Source: https://habr.com/ru/post/61101/


All Articles