[Tutor] Async TCP Server
Simon Connah
scopensource at gmail.com
Wed Apr 25 17:14:17 EDT 2018
Hi,
I've come up with an idea for a new protocol I want to implement in
Python using 3.6 (or maybe 3.7 when that comes out), but I'm somewhat
confused about how to do it in an async way.
The way I understand it is that you have a loop that waits for an
incoming request and then calls a function/method asynchronously which
handles the incoming request. While that is happening the main event
loop is still listening for incoming connections.
Is that roughly correct?
The idea is to have a chat application that can at least handle a few
hundred clients if not more in the future. I'm planning on using
Python because I am pretty up-to-date with it, but I've never written
a network server before.
Also another quick question. Does Python support async database
operations? I'm thinking of the psycopg2-binary database driver. That
way I can offload the storage in the database while still handling
incoming connections.
If I have misunderstood anything, any clarification would be much appreciated.
Simon.
More information about the Tutor
mailing list