本文整理汇总了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"));