Re: [PHP] PHP telnet server
Robert Cummings wrote: It's not easy in any language, but if your key concern is the performance of PHP (as a language), hardware is what you need. You can design your software to run on a single box with lots of CPU cores, or you can go for a distributed (and more easily scalable) approach. If you don't need/want straight scalability, go for the 32 cores all ticking at 3GHz. Once that is saturated, buy another one. If you go multi core then you need to go with a threaded approach... which makes the development a bit complex for newbies to MUD development. 'c...@l-i-e.com' doesn't seem like a newbie to me, but you're right, it would be a complex job for a newbie. Nevertheless, given todays machines where even laptops have multiple cores, I would certainly design any new performance-critical application for multi-threading. (Multi-threading in PHP is a challenge in itself, and I wouldn't choose PHP for such a job, but that's a different story). I don't think I'd go distributed since people whine about lag that takes a 1/4 second... distributed would inherently require more time while messages are passed to and fro. That is perhaps a valid consideration, but isn't it easily dealt with by using gigabit ethernet or infiniband or something similar? The distributed vs. one big monolith discussion is also a matter of space, cooling, electricity etc. The big monolith is easier to deal with, but also carries a different pricetag. The many machines can be gradually expanded at a lower cost, but need much more in terms of infrastructure. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP telnet server
Well the current system runs of a 20MB internet connection in London, seeing as that's the UK that about 2MB. It runs fine, responses are snappy even dealing with loads of users. This, however, is written in C: does PHP have that much of an overhead so that bandwidth is actually that much of an issue? On Thu, 1 Jan 2009, Per Jessen wrote: Robert Cummings wrote: It's not easy in any language, but if your key concern is the performance of PHP (as a language), hardware is what you need. You can design your software to run on a single box with lots of CPU cores, or you can go for a distributed (and more easily scalable) approach. If you don't need/want straight scalability, go for the 32 cores all ticking at 3GHz. Once that is saturated, buy another one. If you go multi core then you need to go with a threaded approach... which makes the development a bit complex for newbies to MUD development. 'c...@l-i-e.com' doesn't seem like a newbie to me, but you're right, it would be a complex job for a newbie. Nevertheless, given todays machines where even laptops have multiple cores, I would certainly design any new performance-critical application for multi-threading. (Multi-threading in PHP is a challenge in itself, and I wouldn't choose PHP for such a job, but that's a different story). I don't think I'd go distributed since people whine about lag that takes a 1/4 second... distributed would inherently require more time while messages are passed to and fro. That is perhaps a valid consideration, but isn't it easily dealt with by using gigabit ethernet or infiniband or something similar? The distributed vs. one big monolith discussion is also a matter of space, cooling, electricity etc. The big monolith is easier to deal with, but also carries a different pricetag. The many machines can be gradually expanded at a lower cost, but need much more in terms of infrastructure. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP telnet server
Luke Slater wrote: Well the current system runs of a 20MB internet connection in London, seeing as that's the UK that about 2MB. It runs fine, responses are snappy even dealing with loads of users. This, however, is written in C: does PHP have that much of an overhead so that bandwidth is actually that much of an issue? The implementation language does not affect your bandwidth requirements at all. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP telnet server
The current system also uses some kind of strange text based database, I was wondering if using MySQL for the database would slow it down too much? Well the current system runs of a 20MB internet connection in London, seeing as that's the UK that about 2MB. It runs fine, responses are snappy even dealing with loads of users. This, however, is written in C: does PHP have that much of an overhead so that bandwidth is actually that much of an issue? The implementation language does not affect your bandwidth requirements at all. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Luke Slater :O) PGP Fingerprint: 643B B93E D979 15C9 5BBD 7AF9 A18B 9831 6600 C396 -BEGIN PGP PUBLIC KEY BLOCK- Version: GnuPG v1.4.9 (GNU/Linux) mQGiBEjrxM0RBADm6CySSIf+t4TqTwXyleiS1dwUJiMiwoesJcerVzGAkl5kJjhv ZQp2uVEeMsX5Wo7/1AxDN8yV9cNRcX0wl8QXAFqn+7XG7GWRQlVMdmftHEFokK+/ FfU5md2c87juGPsJkZcBIu1E2UAbppAzLydRAHMBZUi2+x8X/+Bh1v1j3wCg69EM 2EM6giPRQ9H+GDvSNBfiq+sD/3ZkOeynNx9v4hFegQtRPUe7CxQbjkxzPARO4bBd A4Cx5EHlgKAE3hdZRMl38pl9kBD7s548s2wzKLSCsQeWMJp+bdoxj5mopPWH95hG ITDRUl/i12xC669rYQhGDY+rZW5ltmlhtNBpVHBVbr8/JogJR1/XgW1WFLWlYMTC znnfBADJz6d+CR6SEb1iqAHVGB1sMz5mmTQ/qbtbirkDKC+4DWB0MrmRkllK8PgC Rs+MEhwoVL1zSQPYCChZTFZS7Ja6t7duqbqWOp90gWY4gbFrcihBC+WzkwpRELil T2wVcEtqcU25EVAGmtcAqDxRvQ/2WVReaKBZQ4brCcAGZUSAQLQ7THVrZSBTbGF0 ZXIgKE51LVZvbyBzb2Z0d2FyZSBkZXNpZ24pIDx0aW5tYWNoaW4zQGdtYWlsLmNv bT6IYAQTEQIAIAUCSOvEzQIbIwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEKGL mDFmAMOWtnwAoJFKtRxa6/kHkuq52rI5d+3MrC2BAJ0S0yXE7uKyzuRgFI2Uv4Fw cWWQ5IhgBBMRAgAgBQJI687PAhsjBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQ oYuYMWYAw5aSogCfZTDDPlCnq9dXxax3TQ71f55d1w8AoNlMKmUQdNa4MZMaKyCx bjYKtHz4uQENBEjrxM0QBADSsxd0x6Ioa+b/4OTIp7z2oFm72dS5CuxJl9fuhfPG ee1yfaBHDDTHvh2k9IpWhFC+ZhCJkp560BbOpdGItZ2yhH2cCdrOeYCqiVWQBN5v dwQaJ0o8Z/bSo5xHgLe4iED596rs6lnv8HGBnzoEQNGbexI/p9vbRTvuCLWzPZfu 7wAECwP/cXlVBrfY8E2vt6T9WUGJcWPjx9MM1wY/xLvqyJjmFLc6UAWnbR17Vb0n c/7Af+wD1yFzUlt54bW3hqyn4sKkf6sejupY7sWbBTDCjNCJ5fAGfDzmxha/KYN7 XL7Gjp4pVfmXaPucj9WbQj8uEQi/mQ265GlCNHFofnsBAeOcxZ+ISQQYEQIACQUC SOvEzQIbDAAKCRChi5gxZgDDlugxAJ4+eNpkqv6RELyjw3Bsx6L80maHiwCdFL6I HlaeNZYrTyhaCMt46Gz8kN0= =z+JR -END PGP PUBLIC KEY BLOCK-
Re: [PHP] PHP telnet server
Luke wrote: The current system also uses some kind of strange text based database, I was wondering if using MySQL for the database would slow it down too much? It depends on the type and mix of transactions, but based on the information available, I don't think MySQL will slow it down too much. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP telnet server
On Thu, 2009-01-01 at 11:51 +0100, Per Jessen wrote: Robert Cummings wrote: It's not easy in any language, but if your key concern is the performance of PHP (as a language), hardware is what you need. You can design your software to run on a single box with lots of CPU cores, or you can go for a distributed (and more easily scalable) approach. If you don't need/want straight scalability, go for the 32 cores all ticking at 3GHz. Once that is saturated, buy another one. If you go multi core then you need to go with a threaded approach... which makes the development a bit complex for newbies to MUD development. 'c...@l-i-e.com' doesn't seem like a newbie to me, but you're right, it would be a complex job for a newbie. 'c...@l-i-e.com' isn't the original poster, I was speaking generally... with a possibly nod towards the OP who may be a newbie. Nevertheless, given todays machines where even laptops have multiple cores, I would certainly design any new performance-critical application for multi-threading. (Multi-threading in PHP is a challenge in itself, and I wouldn't choose PHP for such a job, but that's a different story). I don't think I'd go distributed since people whine about lag that takes a 1/4 second... distributed would inherently require more time while messages are passed to and fro. That is perhaps a valid consideration, but isn't it easily dealt with by using gigabit ethernet or infiniband or something similar? We're talking about a text-based MUD here... it's unlikely the user has the will to spring for such resources for this endeavour. The distributed vs. one big monolith discussion is also a matter of space, cooling, electricity etc. The big monolith is easier to deal with, but also carries a different pricetag. The many machines can be gradually expanded at a lower cost, but need much more in terms of infrastructure. Yes, I agree with all your points, just think perhaps you've shot past the target a little ;) 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
Re: [PHP] PHP telnet server
On Thu, 2009-01-01 at 12:53 +, Luke Slater wrote: Well the current system runs of a 20MB internet connection in London, seeing as that's the UK that about 2MB. It runs fine, responses are snappy even dealing with loads of users. This, however, is written in C: does PHP have that much of an overhead so that bandwidth is actually that much of an issue? No the issue was a distributed environment for the MUD that would introduce internal network latency as the machines coordinate amongst themselves. 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
Re: [PHP] PHP telnet server
On Thu, 2009-01-01 at 13:27 +, Luke wrote: The current system also uses some kind of strange text based database, I was wondering if using MySQL for the database would slow it down too much? Which MUD engine are you using? Chances are it's DIKU, or Circle, or Merc or one of the many derivatives. I converted ours years ago from that horrible text format to XML... not that everyone thinks XML is the bee's knees, but it's certainly more flexible than DIKU flat file. MySQL can work, but I don't suggest it as a straight up format. I suggest something like XML (or any other flexible markup language) which is then housed in a MySQL database. You may enjoy the pain of managing 60 different tables though for an object... or not :) 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
Re: [PHP] PHP telnet server
It's actually derived from tinymud. XML is another option, however I've had people tell me not to use that because it's horrifically slow, even though I've used it extensively, through AJAX before and never had a speed issue; although perhaps when dealing with more information it does become an issue? On Thu, 1 Jan 2009, Robert Cummings wrote: On Thu, 2009-01-01 at 13:27 +, Luke wrote: The current system also uses some kind of strange text based database, I was wondering if using MySQL for the database would slow it down too much? Which MUD engine are you using? Chances are it's DIKU, or Circle, or Merc or one of the many derivatives. I converted ours years ago from that horrible text format to XML... not that everyone thinks XML is the bee's knees, but it's certainly more flexible than DIKU flat file. MySQL can work, but I don't suggest it as a straight up format. I suggest something like XML (or any other flexible markup language) which is then housed in a MySQL database. You may enjoy the pain of managing 60 different tables though for an object... or not :) 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP telnet server
Robert Cummings wrote: 'c...@l-i-e.com' isn't the original poster, I was speaking generally... I thought he was the one to bring up his concern about PHP and performance - I could be wrong. That is perhaps a valid consideration, but isn't it easily dealt with by using gigabit ethernet or infiniband or something similar? We're talking about a text-based MUD here... it's unlikely the user has the will to spring for such resources for this endeavour. I guess my ignorance or age (or both) is showing, I have no idea what a text-based MUD is. I thought we were talking some network gaming engine a la WoW and such. I still think my initial response was appropriate though - if PHP as a language is a performance concern, it's best solved by throwing more hardware at it. If that is not an option, don't use PHP. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP telnet server
On Thu, 2009-01-01 at 19:03 +0100, Per Jessen wrote: Robert Cummings wrote: 'c...@l-i-e.com' isn't the original poster, I was speaking generally... I thought he was the one to bring up his concern about PHP and performance - I could be wrong. That is perhaps a valid consideration, but isn't it easily dealt with by using gigabit ethernet or infiniband or something similar? We're talking about a text-based MUD here... it's unlikely the user has the will to spring for such resources for this endeavour. I guess my ignorance or age (or both) is showing, I have no idea what a text-based MUD is. I thought we were talking some network gaming engine a la WoW and such. Text MUDs are the precursor to graphical MUDs. They have been around for about 30-40 years now I think. They still exist with various fan-bases all around the world. They are still a great project for cutting one's teeth into programming since they cover so many different aspects of programming. They are usually played over telnet. http://www.wocmud.org :) telnet wocmud.org 4000 They are however, not nearly as popular as they once were due to the pervasiveness of graphical muds such as the aforementioned WoW and before it Ultima Online, EverQuest, etc. 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
Re: [PHP] PHP telnet server
On Thu, 2009-01-01 at 17:58 +, Luke Slater wrote: It's actually derived from tinymud. XML is another option, however I've had people tell me not to use that because it's horrifically slow, even though I've used it extensively, through AJAX before and never had a speed issue; although perhaps when dealing with more information it does become an issue? XML can have speed issues, but generally speaking not that much to worry about, especially since area files are usually loaded at boot time and the data cached as a template for creating mobs/items on future load requests. The flexibility though, to me, makes it a must have trade-off. Also, my MUD's player files are XML also. There's so much convienve being able to hand edit a player file when issues arise, or even cut and past items from a backup player file into an existing player file. These things used to be binary and everytime the player structure was changed you'd need to do a player file import/export process to update the format. Now there's no dependency like that. 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
Re: [PHP] PHP telnet server
WELL, while we're advertising, tcz.net telnet tcz.net 23 The MUD does indeed cover many aspects of programming, most of them even have their own scripting language! On Thu, 1 Jan 2009, Robert Cummings wrote: On Thu, 2009-01-01 at 19:03 +0100, Per Jessen wrote: Robert Cummings wrote: 'c...@l-i-e.com' isn't the original poster, I was speaking generally... I thought he was the one to bring up his concern about PHP and performance - I could be wrong. That is perhaps a valid consideration, but isn't it easily dealt with by using gigabit ethernet or infiniband or something similar? We're talking about a text-based MUD here... it's unlikely the user has the will to spring for such resources for this endeavour. I guess my ignorance or age (or both) is showing, I have no idea what a text-based MUD is. I thought we were talking some network gaming engine a la WoW and such. Text MUDs are the precursor to graphical MUDs. They have been around for about 30-40 years now I think. They still exist with various fan-bases all around the world. They are still a great project for cutting one's teeth into programming since they cover so many different aspects of programming. They are usually played over telnet. http://www.wocmud.org :) telnet wocmud.org 4000 They are however, not nearly as popular as they once were due to the pervasiveness of graphical muds such as the aforementioned WoW and before it Ultima Online, EverQuest, etc. 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP telnet server
On Thu, 2009-01-01 at 18:43 +, Luke Slater wrote: WELL, while we're advertising, tcz.net telnet tcz.net 23 The MUD does indeed cover many aspects of programming, most of them even have their own scripting language! Which is why PHP seems so lucrative... but one thing you need to keep in mind by using PHP as an in-game item/mobile scripting engine... is that you have to either trust all your builders or sandbox the PHP engine in such instances so that malicious code can't do damage. 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
Re: [PHP] PHP telnet server
Well, I'm only 16 and I'm using 'em. They are pretty good but depreceated rather a lot as graphical MUDs came around. The people on them are generally of the, ah, computing persuasion though so it's a good way to meet people with like interests :) On Thu, 1 Jan 2009, Per Jessen wrote: Robert Cummings wrote: 'c...@l-i-e.com' isn't the original poster, I was speaking generally... I thought he was the one to bring up his concern about PHP and performance - I could be wrong. That is perhaps a valid consideration, but isn't it easily dealt with by using gigabit ethernet or infiniband or something similar? We're talking about a text-based MUD here... it's unlikely the user has the will to spring for such resources for this endeavour. I guess my ignorance or age (or both) is showing, I have no idea what a text-based MUD is. I thought we were talking some network gaming engine a la WoW and such. I still think my initial response was appropriate though - if PHP as a language is a performance concern, it's best solved by throwing more hardware at it. If that is not an option, don't use PHP. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP telnet server
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, Luke Slater How about AJAX and sessions instead of having TCP sockets? http://xajaxproject.org/ Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP telnet server
c...@l-i-e.com wrote: I often thought PHP would be a nice language for a MUD, if one could get the performance out of it... Design your code such that you can just throw more hardware at it whenever you need more performance. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP telnet server
I often thought PHP would be a nice language for a MUD, if one could get the performance out of it... Design your code such that you can just throw more hardware at it whenever you need more performance. That's easily said, but a MUD means all the users have to share a significant portion of your data model. Though I suspect the bandwidth issue would be the main bottleneck most of the time... I don't want to get into this in much detail, mainly because I've spent all of 5 minutes seriously thinking about it, and may just need more bake-time... But it's not ALWAYS that easy to architect something to be shared-nothing even with PHP. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP telnet server
c...@l-i-e.com wrote: I often thought PHP would be a nice language for a MUD, if one could get the performance out of it... Design your code such that you can just throw more hardware at it whenever you need more performance. That's easily said, but a MUD means all the users have to share a significant portion of your data model. That's fine - there are many well-known schemes for distributing and updating such data. Though I suspect the bandwidth issue would be the main bottleneck most of the time... I don't want to get into this in much detail, mainly because I've spent all of 5 minutes seriously thinking about it, and may just need more bake-time... But it's not ALWAYS that easy to architect something to be shared-nothing even with PHP. It's not easy in any language, but if your key concern is the performance of PHP (as a language), hardware is what you need. You can design your software to run on a single box with lots of CPU cores, or you can go for a distributed (and more easily scalable) approach. If you don't need/want straight scalability, go for the 32 cores all ticking at 3GHz. Once that is saturated, buy another one. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP telnet server
On Wed, 2008-12-31 at 16:19 +, c...@l-i-e.com wrote: I often thought PHP would be a nice language for a MUD, if one could get the performance out of it... Design your code such that you can just throw more hardware at it whenever you need more performance. That's easily said, but a MUD means all the users have to share a significant portion of your data model. Though I suspect the bandwidth issue would be the main bottleneck most of the time... Nah, you can run a MUD on most home internet connections these days. It really takes up very little bandwidth. I think our web-based builder eats more bandwidth than the mud itself. 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
Re: [PHP] PHP telnet server
On Wed, 2008-12-31 at 17:35 +0100, Per Jessen wrote: c...@l-i-e.com wrote: I often thought PHP would be a nice language for a MUD, if one could get the performance out of it... Design your code such that you can just throw more hardware at it whenever you need more performance. That's easily said, but a MUD means all the users have to share a significant portion of your data model. That's fine - there are many well-known schemes for distributing and updating such data. Though I suspect the bandwidth issue would be the main bottleneck most of the time... I don't want to get into this in much detail, mainly because I've spent all of 5 minutes seriously thinking about it, and may just need more bake-time... But it's not ALWAYS that easy to architect something to be shared-nothing even with PHP. It's not easy in any language, but if your key concern is the performance of PHP (as a language), hardware is what you need. You can design your software to run on a single box with lots of CPU cores, or you can go for a distributed (and more easily scalable) approach. If you don't need/want straight scalability, go for the 32 cores all ticking at 3GHz. Once that is saturated, buy another one. If you go multi core then you need to go with a threaded approach... which makes the development a bit complex for newbies to MUD development. I don't think I'd go distributed since people whine about lag that takes a 1/4 second... distributed would inherently require more time while messages are passed to and fro. 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
[PHP] PHP telnet server
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, Luke Slater -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP telnet server
On Tue, 30 Dec 2008, Luke Slater wrote: Hi everyone, A quick read over Stevens` A.P.U.E. and UNIX Network Programing Vol. 1 should familarize you with multi-threaded TCP/IP daemon development. ~BAS 1. http://www.kohala.com/start/apue.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP telnet server
I often thought PHP would be a nice language for a MUD, if one could get the performance out of it... 'Course you could always write some of the heaviest bits as extensions... Anyway, I don't think you need the connections to be shared in any special way. Just update your data store and spew out whatever 'diff' you need to for anybody viewing the same room/object. But maybe that's just the stupid way to write a MUD. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP telnet server
On Tue, 2008-12-30 at 21:12 +, 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
Re: [PHP] PHP telnet server
On Tue, 2008-12-30 at 16:21 -0500, Brian A. Seklecki wrote: On Tue, 30 Dec 2008, Luke Slater wrote: Hi everyone, A quick read over Stevens` A.P.U.E. and UNIX Network Programing Vol. 1 should familarize you with multi-threaded TCP/IP daemon development. Couple of problems... 1. he needs ot buy the book 2. he wants to do it in PHP not C 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
Re: [PHP] PHP telnet server
On Tue, Dec 30, 2008 at 16:34, c...@l-i-e.com wrote: I often thought PHP would be a nice language for a MUD, if one could get the performance out of it... 'Course you could always write some of the heaviest bits as extensions... Indeed. I had written a very simple control-panel-like Telnet script in PHP several years ago to handle reboots and emergency situations, but never scaled it for more than one or two connections. Resource usage, however, was negligible - a few Kilobytes, really. Customize your PHP --- trim out extensions you don't need, write common routines as extensions to save parsing time, and tune it to be optimal for the consistent stream of packets sent across the sockets, and I think a MUD could be very successfully authored in PHP. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Unadvertised dedicated server deals, too low to print - email me to find out! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP telnet server
Hello, There are plenty of ready to use solutions to build TCP servers. Here are some of them: Simple TCP Daemon http://www.phpclasses.org/daemon Generic socket based networking servers http://www.phpclasses.org/clssocket Implement TCP socket server scripts http://www.phpclasses.org/flosocket Implement TCP/IP client and servers http://www.phpclasses.org/net Implement TCP socket servers http://www.phpclasses.org/simpleserver Handle multiple TCP socket connections http://www.phpclasses.org/supersocket Build TCP socket networking servers http://www.phpclasses.org/qserv -- Regards, Manuel Lemos Find and post PHP jobs http://www.phpclasses.org/jobs/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP telnet server
That supersocket class certainly seems good enough to get me started, thanks everyone! On Tue, 30 Dec 2008, Manuel Lemos wrote: Hello, There are plenty of ready to use solutions to build TCP servers. Here are some of them: Simple TCP Daemon http://www.phpclasses.org/daemon Generic socket based networking servers http://www.phpclasses.org/clssocket Implement TCP socket server scripts http://www.phpclasses.org/flosocket Implement TCP/IP client and servers http://www.phpclasses.org/net Implement TCP socket servers http://www.phpclasses.org/simpleserver Handle multiple TCP socket connections http://www.phpclasses.org/supersocket Build TCP socket networking servers http://www.phpclasses.org/qserv -- Regards, Manuel Lemos Find and post PHP jobs http://www.phpclasses.org/jobs/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Telnet Deamon?
Hello all, I currently have a generic socket daemon running and doing what it should but I am wondering if there is a way to have a php script act as a telnet daemon? Thanks to you all in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Telnet Deamon?
hi, Theoretically possible but practically very difficult. The telnet protocol is a lot more complex than it looks at first glance. Even to login you need to do a lot of negotiation. Dev wrote: Hello all, I currently have a generic socket daemon running and doing what it should but I am wondering if there is a way to have a php script act as a telnet daemon? Thanks to you all in advance! -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php telnet
The following code generated garbase output. what is wrong ?? ?php $sp = fsockopen(localhost, 23); if(!$sp){ echo error; exit; } socket_set_blocking($sp, FALSE); function getLine(){ global $sp; $op = fgets($sp, 1024); while(empty($op)){ $op = fgets($sp, 1024); } return $op; } echo getLine(); ? The output was as follows: [root@ispms html]# php telnet.php X-Powered-By: PHP/4.1.0 Content-type: text/html ÿý▒ÿý ÿý#ÿý'[root@ispms html]# -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] php telnet
... and what did you expect? :o) Telnet uses charcters under ascii[32] to sync and manage connection/session - try http://www.faqs.org/rfcs/rfc854.html - description of TELNET protocol. M.N. -- kancha wrote: The following code generated garbase output. what is wrong ?? ?php $sp = fsockopen(localhost, 23); if(!$sp){ echo error; exit; } socket_set_blocking($sp, FALSE); function getLine(){ global $sp; $op = fgets($sp, 1024); while(empty($op)){ $op = fgets($sp, 1024); } return $op; } echo getLine(); ? The output was as follows: [root@ispms html]# php telnet.php X-Powered-By: PHP/4.1.0 Content-type: text/html ÿý▒ÿý ÿý#ÿý'[root@ispms html]# -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]