On 25 Aug 2006 09:37:09 -0700, KraftDiner <[EMAIL PROTECTED]> wrote: >If you don't know how long your input data is going to be how can you >at least treat it a text line at a time... like looking for new line in >the data... Right now recv blocks. Yes I could do a select, but the >examples seem a bit complicated for a simple line oriented input...
Here's a simple line-based echo implementation using Twisted: from twisted.internet import reactor, protocol from twisted.protocols import basic class LineEcho(basic.LineReceiver): def lineReceived(self, line): print 'Received line:', repr(line) factory = protocol.ServerFactory() factory.protocol = LineEcho reactor.listenTCP(12345, factory) reactor.run() Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list