Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asyncio vs asyncore for custom server python

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

like image 919
dsal3389 Avatar asked Jul 11 '26 02:07

dsal3389


1 Answers

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.

like image 120
Allan Avatar answered Jul 13 '26 15:07

Allan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!