12 Comments
- MarkByers, on 10/12/2007, -0/+4I used Python + Twisted to write an Internet word game server for fun in my spare time. Twisted solves many problems nicely and it took just a few months to write the whole server. It runs smoothly and is stable. It is fast enough for what I need.
To my surprise and now it has hundreds of happy users. :)
Another thing I like about having it in Python is the ability to upgrade the server code whilst it is still running without interrupting anyone's game. That has saved me a few times, when I wanted to apply a bug fix but people were in the middle of playing.
I think the scalability will become an issue soon but that's more because I wrote it as a hobby project, never really expecting anyone to use it, so I didn't try to make it that scalable. I am sure that with a bit of work I can make it run faster, or at least use more servers.
Summary: I can recommend Python + Twisted for writing network applications, but if you want a lot of users, think about scalability from the start. - MarkByers, on 10/12/2007, -0/+4You change the source code on the disk and then login to the server into a Python terminal. At this point you can type Python statements and they are executed and you have a reference to all objects. If you like you can examine the state of any object, modify values or even rewrite certain functions. Commands you execute are added into the event queue. This is great for debugging, cheating or having some fun with unsuspecting users by changing the state of the game half-way through ;). Actually I don't really use whis feature to cheat, ;). All you need to do is add a few lines to enable this feature in your Twisted application.
Also you can modify the files on disk for a module and then call rebuild for that module. The rebuild is added into the event loop again, and when there is a moment, it reloads the code but keeps the objects members the same. The next time a function is called on that object, the new code is used instead of the old code.
With a bit of clever coding you can even add completely new members and functions to existing objects without bringing the server down and without terminating any games in progress.
There are lots of possibilities. It was definitely an eye-opener for me to learn about Python and Twisted. It was my first large application in Python. - tforcram, on 10/12/2007, -0/+3You've obviously never designed your own network protocol.
- fuzzums, on 10/12/2007, -0/+3Here's a link to the article in print mode that gets ride of the adverts:
http://www.onlamp.com/lpt/a/6680
Fuzzums. - dragazis, on 10/12/2007, -0/+3I love the Twisted frameworks. I am the project manager of SolarSeek and we want to use this library http://twistedmatrix.com/projects/web/ of theirs to help replace our current network core (very unstable and old). I love how underestimated Python is when it really can be one of the most robust languages.
- pcgeek101, on 10/12/2007, -1/+2Use adblock :) Then you don't have to worry about it
- deafmute, on 10/12/2007, -0/+1I use telnet everyday at work. If you are on a secure lan, just use telnet, no need for the ssh overhead. :P
- bootyfarm, on 10/12/2007, -1/+1Ooh, Telnet! That's useful!
- fuzzums, on 10/12/2007, -0/+0I found what you wrote very interesting about updating the server code without causing interruption. How was that done/implemented? Do you just update a class and Python automatically takes into account any changes?
Fuzzums - fabriciom, on 10/12/2007, -0/+0I have yet to attempt to learn Python. The reason being all this has been already done in Perl. I haven’t herd of speed differences so I have assumed they are about the same. Now in Perl you have POE which covers all your threaded networking needs and more.
-Fabricio Martinez
-http://www.fabtechsolutions.com - fuzzums, on 10/12/2007, -0/+0AdBlock has its benefits but the other awesome thing about print preview on such websites is that it lumps all the pages into one page. No need to click on the annoying Next or page numbers. :-)
- hyppysiili, on 10/12/2007, -2/+0I have used PHP for this. Maybe I should star learning Python...


What is Digg?
The Digg Toolbar for Firefox lets you Digg, submit content, and keep track of Digg even when you're not on the Digg site. Download the official