How should I handle socket receiving?

Tim Roberts timr at probo.com
Sun Mar 13 00:13:43 EST 2011


Hans <hansyin at gmail.com> wrote:
>
>I'm thinking to write a code which to:
>1. establish tons of udp/tcp connections to a server

What does "tons" mean?  Tens?  Hundreds?

>my question is how should I handle receiving traffic from each
>connection respectively? 

You're really going to want to use "select".  You can store the objects in
a dictionary where the key is the socket number.  That way, you can use the
result of the select and get your network object directly.
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list