Cháofēng is a simple telnet bbs framework for python
更多的文档写在wiki里.
Here is a simple example app for Chaofeng :
fromchaofengimportFrame, Serverimportchaofeng.asciiascclassHello(Frame):
definitialize(self):
self.write('Hello,World!')
self.close()
defclear(self):
self.write('Don leave me alone ...\r\n')
if__name__=='__main__' :
s=Server(Hello)
s.run()作为服务器,你可以这样运行:
python /path-to-the-file/作为客户端,你可以这样(在linux):
telnet host port一般的,本地的host是填loaclhost,port是5000。所以如果服务器是本地的话,你可以:
telnet localhost 5000