当前位置: 首页>>代码示例>>PHP>>正文


PHP TSocket::close方法代码示例

本文整理汇总了PHP中TSocket::close方法的典型用法代码示例。如果您正苦于以下问题:PHP TSocket::close方法的具体用法?PHP TSocket::close怎么用?PHP TSocket::close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TSocket的用法示例。


在下文中一共展示了TSocket::close方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: hive_check

function hive_check($hive_host,$hive_port,$hive_send_timeout,$hive_recv_timeout) {
	$shell_ret=0;

	try{
		$transport = new TSocket($hive_host,$hive_port);
		$transport->setSendTimeout($hive_send_timeout);
		$transport->setRecvTimeout($hive_recv_timeout);
		$protocol = new TBinaryProtocol($transport);
		$client = new ThriftHiveClient($protocol);
		$transport->open();
		$client->execute('show databases');
		//var_dump($client->fetchAll());
	}catch(Exception $e){
		$shell_ret=1;
	}

	$transport->close();
	return $shell_ret;
}
开发者ID:recruitcojp,项目名称:WebHive,代码行数:19,代码来源:keepalive.php

示例2: while

            while (FALSE !== ($file = readdir($handle))) {
                if ($file != "." && $file != "..") {
                    $arr[$i] = $file;
                    $i++;
                }
            }
            closedir($handle);
        }
        $transport = new TSocket($ip, 30050);
        $protocol = new TBinaryProtocol($transport);
        #$client = new EasyHadoopClient($protocol);
        $transport->open();
        $install->MakeDir($protocol);
        foreach ($arr as $key => $value) {
            $filename = "/home/hadoop/" . $value;
            $fp = fopen("./hadoop/" . $value, "rb");
            while (!feof($fp)) {
                $content .= fread($fp, 1024);
            }
            fclose($fp);
            $str = $install->PushFile($filename, $content, $protocol);
            unset($content);
            sleep(1);
        }
        $transport->close();
        echo "<script>alert('" . $lang['pushComplete'] . "'); this.location='InstallManager.php?action=Install&ip=" . $ip . "';</script>";
    }
} else {
    die($lang['unknownCommand']);
}
include_once "templates/footer.html";
开发者ID:npk,项目名称:easyhadoop,代码行数:31,代码来源:InstallManager.php

示例3: download


//.........这里部分代码省略.........
             }
             if ($link == null) {
                 $link = $links[0];
             }
         } else {
             $link = $links;
         }
     }
     if (strpos($link, "safeurl.")) {
         $newLocation = get_headers($link, 1);
         if (isset($newLocation["Location"])) {
             $link = $newLocation["Location"][0];
         } else {
             $contentWithLink = file_get_contents($link);
             preg_match_all("/(https:\\/\\/rapidshare[a-zA-Z0-9\\.\\-\\/_#+\\|!]*)/", $contentWithLink, $links);
             $links = array_unique($links[1]);
             $link = $links[0];
             $ex = explode("|", $link);
             $ex[0] = str_replace("/#!download", "/files/", $ex[0]);
             $link = $ex[0] . $ex[2] . "/" . $ex[3];
         }
     }
     if (strpos($link, "canhaz.")) {
         $newLocation = get_headers($link, 1);
         $link = $newLocation["Location"];
         $contentWithLink = file_get_contents($link);
         preg_match_all("/(http:\\/\\/rapidshare[a-zA-Z0-9\\.\\-\\/_#+]*)/", $contentWithLink, $links);
         $links = array_unique($links[1]);
         $link = $links[0];
     }
     $linkOld = $link;
     if ($this->A("JDLinkParser") != "") {
         $C = $this->A("JDLinkParser");
         $C = new $C();
         $link = $C->parse($link, $this->A("JDLinkParserUser"), $this->A("JDLinkParserPassword"));
     }
     if ($this->A("JDDLType") == "4") {
         if ($logFilename == "") {
             $info = get_headers($link, 1);
             if ($info !== false) {
                 preg_match("/filename=\"(.*)\"/ismU", $info["Content-Disposition"], $matches);
                 if (isset($matches[1])) {
                     $logFilename = $matches[1];
                 }
             }
         }
         if ($logFilename == "") {
             $logFilename = basename($link);
         }
         $DL = anyC::getFirst("Incoming", "IncomingUseForDownloads", "1");
         $size = $this->filesize($link);
         if ($size < 10 * 1024 * 1024) {
             throw new Exception("File size too small");
         }
         $id = $this->logDownload($logLink, $linkOld, $logFilename, $size, $Serie, true);
         file_put_contents($this->A("JDWgetFilesDir") . "/{$id}.temp", "-o wgetDL_" . str_pad($id, 5, "0", STR_PAD_LEFT) . ".log -O " . rtrim($DL->A("IncomingDir"), "/") . "/" . str_replace(" ", ".", basename($logFilename)) . "." . Util::ext($link) . " {$link}");
         rename($this->A("JDWgetFilesDir") . "/{$id}.temp", $this->A("JDWgetFilesDir") . "/{$id}.dl");
         chmod($this->A("JDWgetFilesDir") . "/{$id}.dl", 0666);
         return true;
     }
     if ($this->A("JDDLType") == "0") {
         Util::PostToHost($this->A("JDHost"), $this->A("JDPort"), "/link_adder.tmpl", "none", "do=Add&addlinks=" . urlencode($link), $this->A("JDUser"), $this->A("JDPassword"));
     }
     if ($this->A("JDDLType") == "1") {
         $xml = Util::PostToHost($this->A("JDHost"), $this->A("JDPort"), "/cgi-bin/Qdownload/DS_Login.cgi", "none", "user=" . $this->A("JDUser") . "&pwd=" . urlencode(base64_encode($this->A("JDPassword"))) . "&admin=1");
         $xml = new SimpleXMLElement(substr($xml, strpos($xml, "<?xml ")));
         $data = Util::PostToHost($this->A("JDHost"), $this->A("JDPort"), "/cgi-bin/Qdownload/DS_Task_Option.cgi", "none", "url=" . urlencode($link) . "&todo=add_rs&type=http_ftp&acc_id=1&user=&pwd=&sid=" . $xml->authSid . "&ver=2.0");
         $xml = new SimpleXMLElement(substr($data, strpos($data, "<?xml ")));
         if ($xml->Result . "" == "success") {
             $this->logDownload($logLink, $link, $logFilename, 0, $Serie);
         }
     }
     if ($this->A("JDDLType") == "2") {
         $content = file_get_contents("http://" . $this->A("JDHost") . ":" . $this->A("JDPort") . "/action/add/links/grabber0/start1/{$link}");
         if (strpos($content, "Link(s) added. (\"{$link}\"") !== false and $logLink != null) {
             $this->logDownload($logLink, $link, $logFilename, 0, $Serie);
         }
     }
     if ($this->A("JDDLType") == "3") {
         $GLOBALS['THRIFT_ROOT'] = Util::getRootPath() . "ubiquitous/Thrift";
         require_once $GLOBALS['THRIFT_ROOT'] . '/Thrift.php';
         require_once $GLOBALS['THRIFT_ROOT'] . '/transport/TTransport.php';
         require_once $GLOBALS['THRIFT_ROOT'] . '/transport/TSocket.php';
         require_once $GLOBALS['THRIFT_ROOT'] . '/protocol/TBinaryProtocol.php';
         require_once $GLOBALS['THRIFT_ROOT'] . '/transport/TFramedTransport.php';
         require_once $GLOBALS['THRIFT_ROOT'] . '/transport/TBufferedTransport.php';
         require_once $GLOBALS['THRIFT_ROOT'] . '/packages/pyload/Pyload.php';
         require_once $GLOBALS['THRIFT_ROOT'] . '/packages/pyload/pyload_types.php';
         $transport = new TSocket($this->A("JDHost"), $this->A("JDPort") * 1);
         $transport->open();
         $protocol = new TBinaryProtocol($transport);
         $client = new PyloadClient($protocol);
         $client->login($this->A("JDUser"), $this->A("JDPassword"));
         #echo $client->getServerVersion();
         #echo "<br />";
         $client->addPackage("trinityDB", array($link), 1);
         #Print 'result = ' . $result;
         $transport->close();
     }
 }
开发者ID:nemiah,项目名称:trinityDB,代码行数:101,代码来源:JD.class.php


注:本文中的TSocket::close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。