Can you tell me: could I use twisted for p2p-applications creating? And what protocols should I choose for this?
Yes, twisted was used to create the initial version of Bittorrent. There are some opensource libraries to start from.
Yes, you can absolutely use twisted to create a p2p application. The one that comes first to my mind is Dtella (http://dtella.org/). It's uses the Direct Connect protocol.
They provide the source code, so that could get you started. I know that quite a few different university networks have DC hubs running. That seems to be the ideal use of this protocol.
The best solution is to use the source code for BitTorrent. It was built with Twisted until they switched over to a C++ implementation called Utorrent.
- Last known Twisted version of BitTorrent
- Older versions
As an alternative, you also might want to take a look at Vertex.
It is a p2p library built on top of Twisted and comes with goodies like bypassing firewalls.
Its probably more complete than the other people's sample.
- Link to Vertex