I'm thinking to write a code which to: 1. establish tons of udp/tcp connections to a server 2. send packets from each connections 3. receive packets from each connections and then do something based on received content and connection statues. 4. repeat step 2 and step 3.
my question is how should I handle receiving traffic from each connection respectively? two ways I'm thinking are: 1. setup connections one by one, put socket handler into an array(dictionary?), array also record each handler's status. then in a big loop, keep using "select" to check sockets, if any socket get something received, then find the socket in the array, based on the socket status to do things should be done. this one is like single- thread? 2. (I don't know if this one works, but I prefer this one if it do works. ) Setup connection object, write codes in the object to handle sending/receiving and status. let each object to check/receive its socket by itslef(I don't know how yet). Then In the main proc, I just initiate those objects. Any responses would be very welcome, thanks. -- http://mail.python.org/mailman/listinfo/python-list