Implementing a twisted matrix and telnet server

I have a project, which is essentially a game server, where users connect and send text commands via telnet.

The code is in C and is really old and non-modular and has several errors and missing functions. The main function is half the code.

I came to the conclusion that rewriting it in Python using Twisted could lead to faster completion, among other benefits.

So, here are the questions: What packages and modules should I use? I see the telnet module inside the protocols package. I also see the cronch package with ssh and another telnet module.

I am a complete newbie in Python.

+3
source share
2 answers

Greg’s suggestion of trying to get to know Python before trying to use Twisted is probably sensible. Limiting the possible sources of your confusion can help you avoid some very unpleasant cases.

On the other hand, I know many people who take the Twisted project as their first Python learning experience and succeed. So it is possible. And first you need to do something. There is no guarantee that what you choose instead of Twisted will be easier. :)

Regarding telnet features, you want to use twisted.conch.telnet, not twisted.protocols.telnet. The first one is a newer one, better tested, more functional and has several examples (although, unfortunately, there is not much documentation besides this).

telnet , , twisted.conch.telnet. , , , , . telnet ( , ), . "telnet" / , , , , . , telnet RFC, ( , ).

, , API self.transport, ( TCP-, Twisted, , TCP, ).

, dataReceived self.transport.write. , ; , .

+5

, :

  • C Python.
  • Twisted.

Python, , Twisted. , - .

C Python Python, Twisted.

+1

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


All Articles