示例#1
0
文件: TCP.php 项目: casan/eccube-2_13
 function run($idleTimeout = null)
 {
     $server =& Net_Server::create($this->type, $this->localaddr, $this->port);
     if (PEAR::isError($server)) {
         echo $server->getMessage() . "\n";
     }
     $handler =& new SOAP_Server_TCP_Handler();
     $handler->setSOAPServer($this);
     // hand over the object that handles server events
     $server->setCallbackObject($handler);
     $server->readEndCharacter = '</SOAP-ENV:Envelope>';
     $server->setIdleTimeout($idleTimeout);
     // start the server
     $server->start();
 }
示例#2
0
 /**
  * サービススタート
  *
  * @param int    $port        ポート番号
  * @param bool   $isFork      サーバータイプ true:folk false:sequential
  * @param string $handlerName サーバーハンドラ名
  * @param string $ipAddress   サーバーIP
  *
  * @return void
  * @see http://pear.php.net/manual/ja/package.networking.net-server.net-server.create.php
  */
 public function start($port = 103754, $isFork = true, $handlerName = 'BEAR_Resource_Server_Handler', $ipAddress = false)
 {
     $type = $isFork ? 'fork' : 'sequential';
     if (!$ipAddress) {
         $hostname = exec('uname -n');
         $ipAddress = gethostbyname($hostname);
     }
     if (class_exists($handlerName)) {
         $server =& Net_Server::create($type, $ipAddress, $port);
         $handler =& new $handlerName();
         $server->setCallbackObject($handler);
         $server->_debug = $this->_config['debug'];
         $this->_printStartUpinfo("{$ipAddress} {$port}", $type);
         $server->start();
         if (PEAR::isError($server)) {
             echo $server->getMessage() . "\n";
         }
     } else {
         trigger_error('Bad Handler :' . $handlerName, E_USER_ERROR);
     }
 }
示例#3
0
            } else {
                $loggers = $this->hierarchy->getCurrentLoggers();
                foreach ($loggers as $logger) {
                    $root->callAppenders($event);
                    $appenders = $logger->getAllAppenders();
                    foreach ($appenders as $appender) {
                        $appender->doAppend($event);
                    }
                }
            }
        }
    }
    function getEvents($data)
    {
        preg_match('/^(O:\\d+)/', $data, $parts);
        $events = split($parts[1], $data);
        array_shift($events);
        $size = count($events);
        for ($i = 0; $i < $size; $i++) {
            $events[$i] = unserialize($parts[1] . $events[$i]);
        }
        return $events;
    }
}
$host = '127.0.0.1';
$port = 9090;
//$server =& Net_Server::create('fork', $host, $port);
$server =& Net_Server::create('sequential', $host, $port);
$handler =& new Net_Server_Handler_Log();
$server->setCallbackObject($handler);
$server->start();
示例#4
0
<?php

$path = '/Applications/XAMPP/xamppfiles/lib/php/pear/';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
$path = './libs/';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'System/Daemon.php';
System_Daemon::setOption("appName", "FastAGI");
System_Daemon::setOption("authorEmail", "*****@*****.**");
System_Daemon::start();
ob_implicit_flush(true);
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();
require_once 'Net/Server.php';
require_once 'libs/FastAGI.php';
$server = Net_Server::create('fork', '127.0.0.1', 10045);
$server->setEndCharacter("\n\n");
$server->setCallbackObject(new FastAGI());
$server->start();
System_Daemon::stop();
#!/usr/bin/env php
<?php 
/**
 * main entry point for starting a Cuke4Php wire server
 * @package Cuke4Php
 */
/**
 * load the Cuke4PhpForkingServer server
 */
require_once dirname(__FILE__) . "/../lib/Cuke4PhpForkingServer.php";
$aOptions = getopt("p:");
if (array_key_exists('p', $aOptions)) {
    $iPort = $aOptions['p'];
} else {
    $iPort = 16816;
}
$oServer =& Net_Server::create('fork', '0.0.0.0', $iPort);
$oServerHandler =& new Cuke4PhpForkingServer(realpath($argv[$argc - 1]), $iPort);
$oServer->setCallbackObject($oServerHandler);
$oServer->start();
示例#6
0
                $this->_server->closeConnection();
            } else {
                $this->_server->sendData($clientId, 'HANGUP');
                $this->_server->closeConnection();
            }
        }
    }
    function process_command($clientId = 0)
    {
        // 	print_r($this->command);
        $dest = stats::get_next_server($this->command[$clientId]['agi_accountcode'], $this->make_up_group($clientId));
        echo "Selected Destination: {$dest}\r\n";
        return "EXEC Dial \"IAX2/{$dest}/" . $this->command[$clientId]['agi_extension'] . "|20\"";
    }
    function make_up_group($clientId)
    {
        if (array_key_exists('group', $this->command[$clientId])) {
            $this->command[$clientId]['group'] = $this->command[$clientId]['group'] + 1;
        } else {
            $this->command[$clientId]['group'] = 0;
        }
        return $this->command[$clientId]['group'];
    }
}
// create a server that forks new processes
$server =& Net_Server::create('fork', '10.10.17.17', 9090);
$handler =& new Net_Server_Handler_Talkback();
// hand over the object that handles server events
$server->setCallbackObject($handler);
// start the server
$server->start();