python - Proper way to implement a Direct Connect client in Twisted? -
I am working on writing a Python client for Direct Connect P2P network. Basically, it works by connecting to a central server, and answering the files which other users are searching for.
Occasionally, another customer asks us to join them, and they can start downloading a file to us. This is a direct connection to other clients, and does not go away from the central server.
What is the best way to handle these connections with other connections? I am currently using a twisted reactor to connect to the server, but is it better that many reactors, each customer is running in a different thread? Or is it a completely different Python script that makes the connection to the client better?
If there is any other solution that I do not know about, then I would love to hear it. I'm new to twisted programming, so I'm open to suggestions and other resources.
Thank you!
Without knowing all the details of the protocol, I still have a reactor - a reactor scale Quite well (especially advanced code like PollReactor
) and this way you will avoid threads connected to threads (in this way twisted and other async systems promote their original performance , To avoid such overhead later) In practice, threads used mainly in twisted Gee are, when you need to interface with a library, whose function can block you.
Comments
Post a Comment