On Tue, 2008-12-30 at 21:12 +0000, Luke Slater wrote: > Hi everyone, > > I'm trying to rewrite an old MUD in PHP; the reasons for this are that the > original is written in C and most files in the codebase run over 2000 > lines with at least 20 of them, which makes it very hard to change > anything. > > Plus, the web interface is also written in C, and needless to say that's > just nasty! > > So I was looking at sockets in PHP, and thinking about the semantics of it > all. > > I was looking at this article: > > http://devzone.zend.com/article/1086-Writing-Socket-Servers-in-PHP > > And thought 'wow this looks like it might be pretty easy actually!' > > But then I reached the first hurdle point: > > ' > /* Accept incoming requests and handle them as child processes */ > $client = socket_accept($sock); > ' > > Surely the point of a MUD is that the requests are shared? > > I also looked up telnet servers in PHP on google quite extensively, and > there seems to be no real information out there? I would imagine that I'm > looking for the wrong thing, however. > > In short I'm looking for the basic idea on how a MUD server would be > implemented in PHP. > > Thanks in advance for anything, You can accept multiple socket connections perfectly fine in PHP. Whether you spawn off child processes to handle them is up to you. But, you will probably want to use socket_set_nonblock() for a mud. I kept my MUD in C though and created my own scripting engine for it... didn't feal like massaging thousands of lines of existing area scripts into a new language. Instead I built a new engine that was backward compatible :) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php