Re: Multi-threaded port listener
| From: | D. Dante Lorenso | Date: | Sun, 30 Apr 2006 03:23:12 +0000 |
| Subject: | Re: Multi-threaded port listener | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-235130@lists.php.net to get a copy of this message | ||
René Fournier wrote:
Anyone find any good tutorials, code samples, etc. on such a thing? Basically, I want to write server (in PHP) that listeners on a particular port, and spins off a thread/process (essentially, execute a separate script) for each incoming connection. There won't be a lot of data to process, but there will be many simultaneous connections—upwards of 1000s of connections (each spun off as seperate threads).Building it yourself can be lots of fun and I have done this using stream_select, fork, and other PCNTL and IPC functions. If you like Pear, you can check out the Net Server package there. They have models to do the forking for you for each client connection: http://pear.php.net/package/Net_Server Although I didn't use Net Server, I did review the code to get ideas on how I'd like to build my server. It is useful. Dante