Re: Net_Server development

From: Date: Mon, 01 Sep 2003 15:39:25 +0000
Subject: Re: Net_Server development
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-20962@lists.php.net to get a copy of this message
Stephan Schmidt wrote:
Hi, I'm currently working on my Net_Server class. The next release will include two classes (three if you count a base class): - Net_Server_Sequential (i.e. the current implementation) - Net_Server_Forking (a server class that will fork independent server processes using pcntl_fork()). Has lesser features (as you do not know about all childs), but enables you to create servers that deliver large amounts of data. Both servers will work with callbacks and can be easily be replaced with each other, you only have to do some minor adjustments. Now I've got some kind of deisng questions as there are two possible approaches. 1. in your application you include Net/Server/Sequential.php or Net/Server/Forking.php and extend this class. Callbacks have to be implemented in the new class. This is the way how it is done with Net_Server 0.9, all users of teh old class had to change was the filename of the include and the classname of the extends. 2. Break BC and instantiate a server with: $server = &Net_Server::create( "Forking", "localhost", 9090 ); $callbackObj = &new MyCallbackObj(); $server->registerCallbackObject($callbackObj); $server->start(); Then the call back object only had methods for the callbacks, plus a $this->_server property (if you want it) that enables you to send data back to the client (as it gives you full access to the server's functionality). Personally I'd prefer the second alternative, as I think it's cleaner. But it breaks BC :-( @Tomas: I hope you are satisfied that I'm working on a new version, that provides the features you wanted. It will only work on Linux, but maybe the threads extension can be used on Windows (not sure what it does and how it works, I only know it's there) Stephan
Stephen, As was discussed at the PEAR meeting, breaking BC is fine before 1.0, so there are no qualms there. It should also (IMNSHO) be assumed that any package below 1.0 is not stable. You might want to look into using shared memory or some such to communicate with the parent daemon, and also it is possible to handle many requests without forking by using ticks (php.net/declare) - you may want to implement this too, as it will work on windows :) Hope these comments are helpful, keep up the good work! - Davey

« previous php.pear.dev (#20962) next »