[Tutor] Async TCP Server
Leam Hall
leamhall at gmail.com
Wed Apr 25 19:37:53 EDT 2018
On 04/25/2018 05:14 PM, Simon Connah wrote:
> 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.
How does your idea differ from Twisted?
More information about the Tutor
mailing list