Esempio n. 1
0
<?php

$port = 0;
$server = null;
while (!$server) {
    $port = rand(50000, 65535);
    $server = @stream_socket_server("tcp://127.0.0.1:{$port}", $errno, $errstr, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN);
}
$pid = pcntl_fork();
if ($pid) {
    test_server();
    pcntl_wait($status);
} else {
    test_client();
}
function read_all_data($conn, $bytes)
{
    $all_data = '';
    $data = '';
    // Loop until we read all the bytes we expected or we hit an error.
    stream_set_timeout($conn, 1);
    while ($bytes > 0 && ($data = fread($conn, $bytes))) {
        $bytes -= strlen($data);
        $all_data .= $data;
    }
    return $bytes == 0 ? $all_data : false;
}
function test_server()
{
    global $server;
    // The server only accepts once, but the client will call
Esempio n. 2
0
<?php

require_once 'wp-config.php';
require_once 'testlib/testlib.php';
// Get DB_NAME
if (MULTISITE === true) {
    $dbname = DB_NAME;
} else {
    $dbname = DB_NAME . '_global';
}
// Get DB_HOST and DB_PORT
if (strrpos(DB_HOST, ':') > 0) {
    $dbhost = substr(DB_HOST, 0, strrpos(DB_HOST, ':'));
    $dbport = substr(DB_HOST, strrpos(DB_HOST, ':') + 1);
} else {
    $dbhost = DB_HOST;
    $dbport = 3306;
}
checkMySQL($dbhost, $dbport, $dbname, DB_USER, DB_PASSWORD, 'wp_users');
test_mail('XTECBLOCS', false, ENVIRONMENT, get_site_option('xtec_mail_logpath'));
test_ldap(false, ENVIRONMENT);
test_proxy('http://www.google.com');
test_server('UTC');
Esempio n. 3
0
    $server = null;
    $port = 0;
    while (!$server) {
        $port = rand(50000, 65535);
        $server = @stream_socket_server("{$scheme}://127.0.0.1:{$port}", $errno, $errstr, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, $contexts[$i]);
    }
    $servers[] = $server;
    $ports[] = $port;
}
foreach ($schemes as $i => $scheme) {
    $server = $servers[$i];
    $port = $ports[$i];
    $pid = pcntl_fork();
    if ($pid) {
        echo "Testing {$scheme}://\n";
        test_server($server);
        pcntl_wait($status);
        exit;
    } else {
        test_client($scheme, $port);
    }
}
unlink($pemfile);
function read_all_data($conn, $bytes)
{
    $all_data = '';
    $data = '';
    // Loop until we read all the bytes we expected or we hit an error.
    stream_set_timeout($conn, 1);
    while ($bytes > 0 && ($data = fread($conn, $bytes))) {
        $bytes -= strlen($data);