Skip to main content

A better API for asynchronous UDP

Project description

AioUDP

Documentation Status

A better API for asynchronous UDP

A websockets-like API for UDP

Here's an example echo server:

import aioudp
import asyncio

async def main():
    async def handler(connection):
        async for message in connection:
            await connection.send(message)
    async with aioudp.serve("localhost", 9999, handler):
        await asyncio.Future()  # Serve forever

if __name__ == '__main__':
    asyncio.run(main())

And a client to connect to the server:

import aioudp
import asyncio

async def main():
    async with aioudp.connect("localhost", 9999) as connection:
        await connection.send(b"Hello world!")
        assert await connection.recv() == b"Hello world!"

if __name__ == '__main__':
    asyncio.run(main())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aioudp-0.1.0.tar.gz (16.8 kB view hashes)

Uploaded Source

Built Distribution

aioudp-0.1.0-py3-none-any.whl (17.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page