From c45fc88fc8a48aea9a972a8c7cbaad677aeb9e69 Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Mon, 19 Jan 2009 18:36:25 +0600 Subject: [PATCH] remove obscure example twisted_ex1.py --- examples/twisted_ex1.py | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 examples/twisted_ex1.py diff --git a/examples/twisted_ex1.py b/examples/twisted_ex1.py deleted file mode 100644 index d30bab2..0000000 --- a/examples/twisted_ex1.py +++ /dev/null @@ -1,37 +0,0 @@ -from twisted.internet.protocol import Protocol, Factory -from twisted.internet import reactor - -from eventlet.green import socket -from eventlet.api import spawn -from eventlet import coros - -class Echo(Protocol): - def dataReceived(self, data): - print 'server received: %r' % data - self.transport.write('you said %s' % data) - -factory = Factory() -factory.protocol = Echo -reactor.listenTCP(34567, factory) - -N=4 -count = coros.metaphore() -count.inc(N) - -def client(): - try: - c = socket.socket() - c.connect(('127.0.0.1', 34567)) - c.send('hello') - print 'client received: %s' % c.recv(1024) - c.send('bye') - print 'client received: %s' % c.recv(1024) - finally: - count.dec() - -for x in range(N): - # note that spawn doesn't switch to new greenlet immediately. - spawn(client) - -# the execution ends with the main greenlet's exit (by design), so we need to pause here -count.wait()