Skip to content

Instantly share code, notes, and snippets.

View jam182's full-sized avatar

Daniele Giancola jam182

View GitHub Profile
@jam182
jam182 / echo_server.py
Last active October 23, 2015 14:37
Echo server that uses only sockets and selects. No threads, asyncio etc.
"""Daniele Giancola 2015
This program is implemented in python3.5.
The idea behind this server is to use non-blocking sockets,
and to schedule callbacks with 'select' when the sockets are ready
to be read or written.
According to the documentation, DefaultSelector() is an alias
for the most efficient implementation (epoll, select, kqueue, iocp, etc.)
based on the current platform.