Skip to content

Instantly share code, notes, and snippets.

View Sulverus's full-sized avatar

Andrey Drozdov Sulverus

View GitHub Profile
@Sulverus
Sulverus / 40str_server.py
Last active December 17, 2015 18:29
small http server fork. with request split and user-agent output=)
from socket import *
LOG_MODE = True
DEFAULT_REPLY = '<h1>Hello world fork=)</h1>'
MAX_RECV = 1024
def server_bind(port, max_conn):
s = socket(AF_INET, SOCK_STREAM)
s.bind(('', port))
s.listen(max_conn)