from twisted.internet import reactor def printMsg(): print 'test message' reactor.stop() reactor.callLater(0, printMsg) reactor.run() class MyProtocol(protocol.Protocol): made = 0 closed = 0 def connectionMade(self): self.made = 1 print self.transport.getPeer().host self.transport.loseConnection() def connectionLost(self, reason): self.closed = 1 print 'connection lost' class TCPClient(protocol.Cl
(oreorebotみたいに)「url送ったらそのページのタイトルを返してくれるボットが欲しいなぁ」と、某IRCで発言したところ、Perl::POEでサクっと作っていただきました。 でも、作りたい衝動を抑えられず、Twisted baseのIRCクライアントを作ってみました。 ソースコード - azukibot - azuki.py Twisted初心者なので、付属していたサンプルのIRCBotを元にしています。 付属のexamples Twisted-2.4.0/TwistedWords-0.4.0/doc/examples/ircLogBot.py サンプルですでにイベントに対応するメソッドが揃っているので、簡単にイベントドリブンなプログラミングができました。 あとはAPIドキュメントをPythonのプロンプトで >>> from twisted.words.protocols imp
Introduction Executive summary Connecting your software - and having fun too! Getting Started Writing a TCP server Basic network servers with Twisted. Writing a TCP client And basic clients. Test-driven development with Twisted Code without tests is broken by definition; Twisted makes it easy to test your network code. Tutorial: Twisted From Scratch The Evolution of Finger: building a simple finge
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く