Skip to content

Instantly share code, notes, and snippets.

@jonashaag
Created March 17, 2012 11:33
Show Gist options
  • Save jonashaag/2057811 to your computer and use it in GitHub Desktop.
Save jonashaag/2057811 to your computer and use it in GitHub Desktop.
bjoern#65 test
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))
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