Re: Sockets: new socket_select() example

From: Date: Thu, 14 Mar 2002 17:40:58 +0000
Subject: Re: Sockets: new socket_select() example
References: 1 2 3 4  Groups: php.dev 
Request: Send a blank email to php-dev+get-81241@lists.php.net to get a copy of this message
I think I got a handle on it now, thanks. Basically, I just had to replace a few of the socket_fd_* calls with things like adding to an array for socket_fd_set() and and in_array() instead of socket_fd_isset(). Attached is a decent example of a multiplexing server using the sockets extension. It's similar to what I've been using in 4.1.x, which has run fine on a production server for quite a while now. Basically, it accepts up to 5 clients, waits for data from any one of the clients, then echoes that data back to all of the clients, kind of like a little chat server. Might be a nice example as a somewhat advanced use of the sockets extension. It's meant to be run via the CLI interface, of course. J Jason Greene wrote: > Due to popular request, here is an example of the new socket_select(): > NOTE: ***This code does not do any error handling*** >

Attachment: [text/x-c++src] sample.php
« previous php.dev (#81241) next »