Skip to content

uSpike/telnetio

Folders and files

NameName
Last commit message
Last commit date
Jan 5, 2025
Feb 21, 2024
Feb 21, 2024
Feb 21, 2024
Jun 22, 2021
Apr 29, 2024
Jun 22, 2021
Jun 27, 2021
Apr 29, 2024
Feb 21, 2024
Apr 28, 2022

Repository files navigation

telnetio

A Sans-IO implementation of a telnet parser.

Includes an anyio server implementation. To install use the anyio extra, such as pip install telnetio[anyio].

import anyio
from anyio.abc import AnyByteStream

from telnetio import AnyioTelnetServer

async def handler(stream: AnyByteStream) -> None:
    async with stream, AnyioTelnetServer(stream) as telnet:
        async for data in telnet:
            await telnet.send(data)

async def main() -> None:
    listener = await anyio.create_tcp_listener(local_port=1234)
    await listener.serve(handler)

anyio.run(main)

See the examples directory for more examples.