Friday, March 5, 2004

Twisted "chat server" in one expression

Tonight's messed up code:


(lambda r,p,b: (r.listenTCP(6665,(type('F',(p.Factory,object),{'protocol':(type('P',(b.LineReceiver,object),{'connectionMade':lambda s:s.factory.c.append(s),'lineReceived':lambda s,m:(s.factory.m(m),None)[1]})),'c':[],'m':lambda s,m:[c.sendLine(m)for c in s.c]}))()),r.run()))(*(lambda p,i:(i(p,'reactor'),i(p,'protocol'),i('twisted.protocols.','basic')))('twisted.internet.',lambda a,b:__import__(a+b,None,None,b)))

2 comments:

  1. You are a very very sick man

    ReplyDelete
  2. just wanted to point out that 'telnet' is a better client than netcat, because nc doesn't flush its buffers as aggressively as telnet does.

    Just thought that was important to mention for those who are using the jcalderoneTwistedChatServer3000

    ReplyDelete