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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file aioudp-0.1.0.tar.gz.

File metadata

  • Download URL: aioudp-0.1.0.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.10 CPython/3.9.1 Darwin/20.6.0

File hashes

Hashes for aioudp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a2485e828820a29127897d6e511cfd5fc386a48bcc861c00ffb6cee862cf9190
MD5 6ae88c0043cc01021004dc193eb0186a
BLAKE2b-256 a50387e275a0c2478f8bc8fc57bf8ee65f811093de533f084731554baa3db24e

See more details on using hashes here.

File details

Details for the file aioudp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: aioudp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.10 CPython/3.9.1 Darwin/20.6.0

File hashes

Hashes for aioudp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 51af7e841e1ccee7b1dac83c7bf38a0a93eb99e19eaef88dd8edd3238cb6e60d
MD5 bc6519900d1616a9271200fdafdbaa08
BLAKE2b-256 a853961e4ae23e334fdf6ba8acbc0c0cbcb7d089e607892907aea45d9aef656e

See more details on using hashes here.

Supported by

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