This is a discussion on Any Good Muti-User SOCKET Server examples? within the alt.comp.lang.php forums, part of the PHP Programming Forums category; I've been looking all over the net for decent socket server examples (step-by-step would be nice). I ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I've been looking all over the net for decent socket server examples (step-by-step would be nice). I can't seem to find anything that comes close to handling multiple users as simple as possible. If you find anything please post it here. Any help would be totally Awesome-O 8 ) thanks in advance. ---------------------------------------- Worlds Funnest Mass Multiplayer Game http://hexmud.com telnet://hexmud.com:4000 * Play Now - It's 100% FREE! * |
|
|||
|
Hello,
on 04/27/2009 10:20 PM the Big H said the following: > > I've been looking all over the net for decent socket server examples > (step-by-step would be nice). I can't seem to find anything that comes > close to handling multiple users as simple as possible. If you find > anything please post it here. Any help would be totally Awesome-O 8 ) You may want to take at this PHP class that can handle multiple clients connecting to multiple sockets at the same time. http://www.phpclasses.org/supersocket -- 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/ |
|
|||
|
the Big H wrote:
> > I've been looking all over the net for decent socket server examples > (step-by-step would be nice). I can't seem to find anything that comes > close to handling multiple users as simple as possible. If you find > anything please post it here. Any help would be totally Awesome-O 8 ) > That's really because its not something you would normally use php for. If you want to write a daemon, and you are on a Linux platform, the simplest thing to do is to hook a program into inetd..its been a while, but that is a multi programmed multi session general purpose daemon that handles all the nasty stuff and simply invokes your program to deal with any incoming socketry. In that sense its pretty similar in general to the way apache hooks into php. You get incoming data from the socket passed as stdin, and you write to stdout, and inetd ensures that goes to and from the TCP/IP socket specified in /etc/indetd.conf. > thanks in advance. > > ---------------------------------------- > Worlds Funnest Mass Multiplayer Game > http://hexmud.com > telnet://hexmud.com:4000 > * Play Now - It's 100% FREE! * |
|
|||
|
On 28 Apr, 02:20, the Big H <ureg...@NOSPAM.com> wrote:
> I've been looking all over the net for decent socket server examples > (step-by-step would be nice). I can't seem to find anything that comes > close to handling multiple users as simple as possible. If you find > anything please post it here. Any help would be totally Awesome-O 8 ) > > thanks in advance. > > ---------------------------------------- > Worlds Funnest Mass Multiplayer Gamehttp://hexmud.com > telnet://hexmud.com:4000 > * Play Now - It's 100% FREE! * Not when I last looked: there was lots of code out there but most of it was buggy or badly written/documented. Most of it was also about writing client sockets - not server sockets. I'm in the process of trying to write a server which has to execute as a single thread with non-blocking I/O (but I don't have any of the source code to hand). If having it run as a single thread is not a requirement then I'd recommend using [x]inetd to manage the sockets and simply have the PHP script using stdio. I had lots of problems initially when I tried using the stream_ functions most of which just went away when I switched to using the basic socket_ functions. HTH C. |