Last active
May 8, 2017 08:51
-
-
Save hightemp/2d4a09b697e996de59d86ffb8a6b32e3 to your computer and use it in GitHub Desktop.
[Python] [Gevent] Server based on gevent
This file contains hidden or 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 gevent | |
def fnServer(port): | |
from gevent import socket | |
s = socket.socket() | |
s.bind(('0.0.0.0', port)) | |
s.listen(500) | |
while True: | |
cli, addr = s.accept() | |
gevent.spawn(handle_request, cli, gevent.sleep) | |
fnServer(8090) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment