Thursday, September 22, 2011

twisted daemons made easy

A little while ago when I was working on socket servers in php language(stupid), i was trying to figure out daemons. Around that time, I discovered that the language twisted python was probably the best things for many multiple connections, because it shoves all of the connections into one thread(a finite resource).

So In comes twisted python and it's a lot different than php, but I am liking it.

The tutorial http://twistedmatrix.com/documents/current/core/howto/tutorial/index.html starts from very early on, and if you play around with each example, you learn small things about python. The examples are incremental enough that you can encapuslate all the new knowledge of each before you move on. It's pretty nice.

And eventually, you can run the server with the command
twisted -y myservername.tac
Which is awesome because it turns it into a daemon for you, running in the background.
It will write to a .pid file. Open the pid file and with that number
kill -INT 1255
in that case i used 1255 as the number within the pid.

So this is working daemons in action.

It always strikes me as odd where I end up finding some pieces of information. I wish there was a site that had so organized, complete collections of knowledge in their vast entirety. For now I will bounce around as fast as I can.

No comments:

Post a Comment