[Twisted-Python] UDP and multiple access
Sebastien Kirche
sebastien.kirche.no at spam.free.fr.invalid
Sun Oct 10 15:55:00 MDT 2004
Hi,
I am working on a little project to list the servers of the online game
«Enemy Territory» and also to list/find a known player. I try to use twisted
to simplify the network access.
I am new both to twisted and python, but as i am also a programmer, learning
is quite easy.
The task consists in 2 times:
1) one UDP request to the master server at idsoftware that returns the list
of the active (slaves) servers (currently around 2020 hosts)
2) one UDP request to *each* slave server to obtain characteristics (name,
map that is played, ...) and the list of the players
For the time i managed to perform the task 1) and i can obtain the list of
the hosts:ports to ask for.
If someone would like to peek an eye on my code, i uploaded it [1].
My problem is now to send around 2000+ non blocking requests and to take the
answers as they come back.
Data treatment should not be a problem, but i don't really see how to
perform the mass request.
I don't understand clearly the twisted terminology (protocols, factory,
...). I have seen in another script [2] a case where there is just one
datagramReceived that checks on the host:port of the datagram to distinguish
the answers, but that is kind of a library, and it only shows 2 requests for
a test. I have no idea for the mass request.
Would someone be kind to guide me a little about it ? For example by just
giving me a snippet for a multiple UDP request with the hosts are in a list,
and if the datagramReceived will suit the response treatment.
I hope to be clear enough. TIA.
Footnotes:
[1] http://sebastien.kirche.free.fr/python_stuff/master_query.py
(comments welcome)
[2] http://sebastien.kirche.free.fr/python_stuff/twist_p2p.py (initially
published in the twisted mailing-list)
Sébastien Kirche
More information about the Twisted-Python
mailing list