Skip to content

Instantly share code, notes, and snippets.

View KrisMelikova's full-sized avatar

Kristina Melikova KrisMelikova

View GitHub Profile
@KrisMelikova
KrisMelikova / simple_echo_server_async.py
Created April 13, 2023 06:36
A simple echo server with asyncio
import asyncio
from asyncio import AbstractEventLoop
import socket
import logging
import signal
from typing import List
async def echo(connection: socket, loop: AbstractEventLoop) -> None:
try:
@KrisMelikova
KrisMelikova / simple_echo_server.py
Last active April 11, 2023 06:37
A simple echo server
import selectors
import socket
from selectors import SelectorKey
from typing import List, Tuple
selector = selectors.DefaultSelector()
server_socket = socket.socket()
server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)