📜 ⬆️ ⬇️

Taming file sharing P2P networks. DC (Dirrect Connect)

Every user of peer-to-peer DC networks and programs like ApexDC, StrongDC probably encountered a problem: It’s not possible to browse a file before downloading it. And if for pictures and mp3 the situation is not very critical, for the video things are really very bad.

Problem:


There are a lot of unfamiliar films (music, pictures), I want to choose something, I don’t want to wait until the entire file rolls up and find in it nothing at all what was expected.

Task


Develop and implement a system that would provide:
1) View video, music, pictures from a shared resource in DC.
2) Viewing the file, starting from any position (ie, rewind)
')

Decision


Great and mighty Google, could not give a ready-made solution (if you managed to find it, throw off a reference), I give a description of my solution.

Before me there were two main problems:
1) Get the desired fragment of the file, starting from any position, not only from the beginning to the end.
2) Feed the resulting stream of audio / video bytes to the player.

The first problem was successfully solved after analyzing the DC protocol, as it turned out, he supports this possibility.
To solve the second problem, I drew attention to the wonderful opportunity of some players (mplayer, winamp) to open (and rewind) files via HTTP.

Here it is, the solution!
It is enough to build a web server adapter protocol DC to the HTTP protocol.

What came out of this can be assessed here MediaDC (Please take into account that this site, like the video shown on its pages, was designed with a view to a specific local area network, and no Internet connection was intended.

At the moment, the program is a prototype rather than a ready-made solution, however, it has already been loved by many users of our local network, I will be happy with suggestions and development assistance.

After some time, I discovered the ability of many operating systems to mount WebDAV as a local file system. This will probably be the next step in the development of the program.

Thanks for attention.

ps This is my first Habratopik, please do not kick much :)

UPD: Updated version, added message if port is busy. Mirror of the site mdc.505.ru (there is no better domain yet :))

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


All Articles