Skip to content

Instantly share code, notes, and snippets.

View y-ookuma's full-sized avatar

y-ookuma

  • tokyo
View GitHub Profile
@vxgmichel
vxgmichel / udpproxy.py
Created February 2, 2017 10:05
UDP proxy server using asyncio
"""UDP proxy server."""
import asyncio
class ProxyDatagramProtocol(asyncio.DatagramProtocol):
def __init__(self, remote_address):
self.remote_address = remote_address
self.remotes = {}
@vxgmichel
vxgmichel / aioudp.py
Last active February 15, 2024 00:12
High-level UDP endpoints for asyncio
"""Provide high-level UDP endpoints for asyncio.
Example:
async def main():
# Create a local UDP enpoint
local = await open_local_endpoint('localhost', 8888)
# Create a remote UDP enpoint, pointing to the first one
@yiwenlu66
yiwenlu66 / udpbroadcast.py
Last active December 20, 2022 17:56
udp broadcast with asyncio
import asyncio
import socket
from string import ascii_letters
import random
class BroadcastProtocol:
def __init__(self, loop):
self.loop = loop