Created
March 17, 2012 11:33
-
-
Save jonashaag/2057811 to your computer and use it in GitHub Desktop.
bjoern#65 test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
c1 = socket.create_connection(('localhost', 8000)) | |
c2 = socket.create_connection(('localhost', 8000)) | |
c2.send('GET / HTTP/1.1\r\n\r\n') | |
c1.send('GET / HTTP/1.1\r\n\r\n') | |
print repr(c1.recv(21)) | |
print repr(c2.recv(21)) | |
print repr(c1.recv(5)) | |
print repr(c2.recv(5)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from peak import context | |
class Counter(context.Service): | |
value = 0 | |
def inc(self): | |
self.value += 1 | |
def app(environ, start_response): | |
start_response('200 ok', []) | |
print 'before inc:', Counter.value | |
Counter.inc() | |
yield 'hi' | |
print 'after inc:', Counter.value | |
yield 'hi2' | |
import bjoern | |
bjoern.run(app, '127.0.0.1', 8000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment