asyncio Question

Joseph L. Casale jcasale at activenetwerx.com
Fri Mar 15 20:45:21 EDT 2019


> -----Original Message-----
> From: Python-list <python-list-
> bounces+jcasale=activenetwerx.com at python.org> On Behalf Of Simon
> Connah
> Sent: Thursday, March 14, 2019 3:03 AM
> To: Python <python-list at python.org>
> Subject: asyncio Question
> 
> Hi,
> 
> Hopefully this isn't a stupid question. For the record I am using Python
> 3.7 on Ubuntu Linux.
> 
> I've decided to use asyncio to write a TCP network server using Streams
> and asyncio.start_server(). I can handle that part of it without many
> problems as the documentation is pretty good. I have one problem though
> that I am not sure how to solve. Each request to the server will be a
> JSON string and one of the components of the JSON string will be the
> latitude and longitude. What I want to do is associate a latitude and
> longitude with the client connection. Every time the latitude and
> longitude changes then the two values will be updated. There will only
> ever be one latitude and longitude for each client connection (since a
> device can only ever be in one place). I'm just not sure what the best
> method to achieve this would be when using asyncio.start_server().

As you expect the client to provide the latitude and longitude, so what
happens when it misbehaves either by accident or intentionally and
all of a sudden you have several connections from the same values?

You'd better rely on your means of differentiating them.



More information about the Python-list mailing list