本文整理匯總了PHP中TSocket::setDebug方法的典型用法代碼示例。如果您正苦於以下問題:PHP TSocket::setDebug方法的具體用法?PHP TSocket::setDebug怎麽用?PHP TSocket::setDebug使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TSocket
的用法示例。
在下文中一共展示了TSocket::setDebug方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: add_node
public static function add_node($host, $port = self::DEFAULT_THRIFT_PORT, $perist = true, $read_timeoutms = 300)
{
try {
// Create Thrift transport and binary protocol cassandra client
$sock = new TSocket($host, $port, $perist);
$sock->setRecvTimeout(10000);
$sock->setDebug('error_log');
$transport = new TBufferedTransport($sock, 10240, 10240);
$client = new CassandraClient(new TBinaryProtocolAccelerated($transport));
// Store it in the connections
self::$connections[] = array('transport' => $transport, 'client' => $client);
// Done
return TRUE;
} catch (TException $tx) {
self::$last_error = 'TException: ' . $tx->getMessage() . "\n";
}
return FALSE;
}
示例2: dirname
$GLOBALS['THRIFT_ROOT'] = !isset($GLOBALS['THRIFT_ROOT']) ? CODE_BASE2 . '/third_part/thrift-0.5.0' : $GLOBALS['THRIFT_ROOT'];
require_once $GLOBALS['THRIFT_ROOT'] . '/Thrift.php';
require_once $GLOBALS['THRIFT_ROOT'] . '/packages/scribe/scribe.php';
require_once $GLOBALS['THRIFT_ROOT'] . '/protocol/TBinaryProtocol.php';
require_once $GLOBALS['THRIFT_ROOT'] . '/transport/TSocket.php';
require_once $GLOBALS['THRIFT_ROOT'] . '/transport/THttpClient.php';
require_once $GLOBALS['THRIFT_ROOT'] . '/transport/TFramedTransport.php';
require_once $GLOBALS['THRIFT_ROOT'] . '/transport/TBufferedTransport.php';
//生成的文件
require_once dirname(__FILE__) . '/Hive.php';
//數據庫文件
include_once '../DB/MyDB.class.php';
ERROR_REPORTING(E_ALL);
INI_SET('DISPLAY_ERRORS', 'ON');
$socket = new TSocket('hive.corp.xx.com', 13080);
$socket->setDebug(TRUE);
// 設置接收超時(毫秒)
$socket->setSendTimeout(10000);
$socket->setRecvTimeout(30 * 60 * 1000);
//接受時間設置為30分鍾
//$transport = new TBufferedTransport($socket, 1024, 1024);
$transport = new TFramedTransport($socket);
$protocol = new TBinaryProtocol($transport);
$client = new HiveClient($protocol);
try {
$transport->open();
} catch (TException $tx) {
echo $tx->getMessage();
exit;
}
$yesterday = date("Y-m-d", strtotime("-1 day"));