I wanna build a custom server for some project and I don't know whats the difference between asyncore
and asyncio
server, what is better to use, and why
asyncore
is the "old", Python 2 way of doing some basic event-driven servers and clients (in other words, for doing asynchronous IO).
asyncio
is the new, Python 3 module that provides a whole framework for doing asynchronous IO in general. It has much more features, including support for coroutines, which allow you to use keywords like async def
and await
, which improve readability of asynchronous code.
In summary, asyncio
is the way to go. asyncore
is not recommended in Python 3, which new projects should be using instead of Python 2. If you are stuck with Python 2, asyncore
is a sane choice.