#!/usr/local/bin/php <?PHP // server base class require_once 'Net/Server.php'; // base class for the handler require_once 'Net/Server/Handler.php'; /** * simple example that implements a talkback. * * Normally this should be a bit more code and in a separate file */ class Net_Server_Handler_Talkback extends Net_Server_Handler { /** * If the user sends data, send it back to him * * @access public * @param integer $clientId * @param string $data */ function onReceiveData( $clientId = 0, $data = "" ) { $this->_server->sendData( $clientId, "You said: $data" ); } } // create a server that forks new processes $server = &Net_Server::create('fork', 'localhost', 9090); $handler = &new Net_Server_Handler_Talkback; // hand over the object that handles server events $server->setCallbackObject($handler); // start the server $server->start(); ?>
Deliver First Class Web Sites: 101 Essential Checklists Want to learn how to make your web sites usable and accessible? Want to ensure that your sites meet current best practice, without spending hours trawling through incomprehensible specifications and recommendations from dozens of different books, research papers, and web sites? Want to make sure that the sites you build are "right the first time," requiring no costly redevelopments?