Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

server

  • Loading branch information...
commit 2cd969a0f1830980d73aabf92e774366f497a2c2 1 parent 48de43c
@lemanyk authored
Showing with 27 additions and 0 deletions.
  1. +3 −0  __init__.py
  2. +20 −0 server.py
  3. +4 −0 tests.py
View
3  __init__.py
@@ -0,0 +1,3 @@
+# coding: utf-8
+
+from server import Server
View
20 server.py
@@ -0,0 +1,20 @@
+from gevent.server import StreamServer
+
+
+class Server(StreamServer):
+ """
+ """
+ def __init__(self, port, host='0.0.0.0'):
+ self.port = port
+ self.host = host
+
+ def start(self):
+ print 'start on %s %s' % (self.host, self.port)
+ self.server = StreamServer((self.host, self.port), self.handle)
+ self.server.serve_forever()
+
+ def handle(self, sock, addr):
+ pass
+
+ def stop(self):
+ print 'seeya!'
View
4 tests.py
@@ -0,0 +1,4 @@
+from server import Server
+
+
+Server(port=5000).start()
Please sign in to comment.
Something went wrong with that request. Please try again.