We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Welcome to the cháofēng wiki!
Cháofēng是一个用python实现的telnet server端,主要设计于实现telnet bss。
Cháofēng基于eventlet。开始Cháofēng是因为学习socket相关的网络编程,而且想要为校内的telnet bbs做一点努力。
Cháofēng会是一个通用的框架——这意味着应该可以让任何一个telnet server端使用Cháofēng来重新实现。
目前chaofeng只在linux平台(archlinux),使用python2.7 经过测试。
在这之前,请确保你已经安装了eventlet库,并且满足了相关依赖,确认没有出错信息:
python -c 'import eventlet'
然后,你可以这样来进行安装:
git clone git@github.com:LTaoist/chaofeng.git cd chaofeng sudo python setup.py install
这里是一个简单的例子:
# hello.py from chaofeng import Frame, Server import chaofeng.ascii as c class Hello(Frame): def initialize(self): self.write('Hello,World!') self.close() def clear(self): self.write('Don leave me alone ...\r\n') if __name__ == '__main__' : s = Server(Hello) s.run()
将这段代码保存为hello.py 然后开始启动:
python hello.py
然后,用另一个终端telnet进去(当然,其他的终端机也可以。默认的,将会使用5000端口):
telnet localhost 5000
你将会看到输出的Hello,world。
点这里来看更多的说明。
:-) 文档继续努力中……