Skip to content

Instantly share code, notes, and snippets.

@hightemp
Last active May 8, 2017 08:51
Show Gist options
  • Save hightemp/2d4a09b697e996de59d86ffb8a6b32e3 to your computer and use it in GitHub Desktop.
Save hightemp/2d4a09b697e996de59d86ffb8a6b32e3 to your computer and use it in GitHub Desktop.
[Python] [Gevent] Server based on gevent
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