by MovingTarget
on 02/12/2009 17:26, 0 messages, last message: 02/12/2009 17:26, 1223 views, last view: 04/30/2024 20:37 |
Hey all!
I became interested in a masterserver implementation yesterday, so I searched around the forum like someone suggested. I came across Drakas' PHP one, but I do not know PHP, and I wanted to see how it worked.
I browsed around a bit more, and found that it would be quite simple to code your own, as it simply has to respond to two commands. Python being the language of choice for my quick prototyping sessions, I threw together a 65-line piece of code in a few hours, and am rather happy with the results. I'm sure people will find stuff to improve... if you do, tell me!
It's really just a simple request handler derived from BaseHTTPRequestHandler. It uses the socket library to ping the registering server. Note that I did not use Python 3.0, I used 2.6.
http://pastebin.com/f2ba1dee4
|